orders

package
v0.0.0-...-cc62b53 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COD = PaymentMethod(iota)
)

Variables

View Source
var (
	OrderState = transition.New(&Order{})
	ItemState  = transition.New(&OrderItem{})
)

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     PaymentMethod
	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
	transition.Transition
}

func (Order) Amount

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

func (Order) Total

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

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

type PaymentMethod

type PaymentMethod uint8

func (PaymentMethod) String

func (pm PaymentMethod) String() string

Jump to

Keyboard shortcuts

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