orders

package
v0.0.0-...-3a4e909 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OrderState order's state machine
	OrderState = transition.New(&Order{})

	// ItemState order item's state machine
	ItemState = transition.New(&OrderItem{})
)
View Source
var (
	// DraftState draft state
	DraftState = "draft"
)

Functions

This section is empty.

Types

type DeliveryMethod

type DeliveryMethod struct {
	gorm.Model

	Name  string
	Price float32
}

type Order

type Order struct {
	gorm.Model
	UserID                   *uint
	User                     users.User
	PaymentAmount            float32
	PaymentTotal             float32
	AbandonedReason          string
	DiscountValue            uint
	DeliveryMethodID         uint `form:"delivery-method"`
	DeliveryMethod           DeliveryMethod
	PaymentMethod            string
	TrackingNumber           *string
	ShippedAt                *time.Time
	ReturnedAt               *time.Time
	CancelledAt              *time.Time
	ShippingAddressID        uint `form:"shippingaddress"`
	ShippingAddress          users.Address
	BillingAddressID         uint `form:"billingaddress"`
	BillingAddress           users.Address
	OrderItems               []OrderItem
	AmazonAddressAccessToken string
	AmazonOrderReferenceID   string
	AmazonAuthorizationID    string
	AmazonCaptureID          string
	AmazonRefundID           string
	PaymentLog               string `gorm:"size:655250"`
	transition.Transition
}

func (Order) Amount

func (order Order) Amount() (amount float32)

func (Order) DeliveryFee

func (order Order) DeliveryFee() (amount float32)

DeliveryFee delivery fee

func (Order) ExternalID

func (order Order) ExternalID() string

func (Order) IsCart

func (order Order) IsCart() bool

func (Order) Total

func (order Order) Total() (total float32)

func (Order) UniqueExternalID

func (order Order) UniqueExternalID() string

type OrderItem

type OrderItem struct {
	gorm.Model
	OrderID         uint
	SizeVariationID uint `cartitem:"SizeVariationID"`
	SizeVariation   *products.SizeVariation
	Quantity        uint `cartitem:"Quantity"`
	Price           float32
	DiscountRate    uint
	transition.Transition
}

func (OrderItem) Amount

func (item OrderItem) Amount() float32

Amount order item's amount

func (*OrderItem) ColorName

func (item *OrderItem) ColorName() string

ColorName order item's color name

func (OrderItem) IsCart

func (item OrderItem) IsCart() bool

IsCart order item's state is cart

func (*OrderItem) ProductImageURL

func (item *OrderItem) ProductImageURL() string

ProductImageURL get product image

func (*OrderItem) ProductName

func (item *OrderItem) ProductName() string

ProductName order item's color name

func (*OrderItem) ProductPath

func (item *OrderItem) ProductPath() string

ProductPath order item's product name

func (*OrderItem) SellingPrice

func (item *OrderItem) SellingPrice() float32

SellingPrice order item's selling price

func (*OrderItem) SizeName

func (item *OrderItem) SizeName() string

SizeName order item's size name

type PaymentMethod

type PaymentMethod = string
const (
	COD        PaymentMethod = "COD"
	AmazonPay  PaymentMethod = "AmazonPay"
	CreditCard PaymentMethod = "CreditCard"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL