Documentation ¶
Index ¶
- Constants
- func ValidateNextOrderState(prveState int8, nextState int8) error
- type Article
- type File
- type Order
- func CancelOrder(order *Order) (*Order, error)
- func ConfirmReceivedOrder(order *Order) (*Order, error)
- func NewOrder(stock primitive.ObjectID, user primitive.ObjectID, notes string) (*Order, error)
- func PrepareOrder(order *Order) (*Order, error)
- func PurchaseOrder(order *Order, paymentMethod int8, paymentRef string) (*Order, error)
- func ShipOrder(order *Order, trackingRef string) (*Order, error)
- func UpdateStateOrder(order *Order, state int8) (*Order, error)
- type Stock
- type StockArticle
- type StockOrderArticle
- type StockOrderArticleItem
- type User
Constants ¶
View Source
const ( ORDER_STATUS_PENDING int8 = 0 ORDER_STATUS_PURCHASED int8 = 1 ORDER_STATUS_PREPARING int8 = 2 ORDER_STATUS_SHIPPING int8 = 3 ORDER_STATUS_RECEIVED int8 = 4 ORDER_STATUS_CANCELLED int8 = 5 )
View Source
const ( ORDER_PAYMENT_METHOD_CASH int8 = 0 ORDER_PAYMENT_METHOD_BANK_TRANSFER int8 = 1 ORDER_PAYMENT_METHOD_CREDIT_CARD int8 = 2 ORDER_PAYMENT_METHOD_PAYPAL int8 = 3 )
Variables ¶
This section is empty.
Functions ¶
func ValidateNextOrderState ¶
Types ¶
type Article ¶
type Article struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` Description string `bson:"description" json:"description"` Price float64 `bson:"price" json:"price"` Images []primitive.ObjectID `bson:"images" json:"images"` Category string `bson:"category" json:"category"` Rating int8 `bson:"rating" json:"rating"` Stock []Stock `bson:"stock,omitempty" json:"stock"` CreatedAt int32 `bson:"createdAt,omitempty" json:"createdAt"` UpdatedAt int32 `bson:"updatedAt,omitempty" json:"updatedAt"` Disabled bool `bson:"disabled"` Available bool `bson:"available"` }
Article definition
type Order ¶
type Order struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Stock primitive.ObjectID `bson:"stock,omitempty" json:"stock"` User primitive.ObjectID `bson:"user,omitempty" json:"user"` State int8 `bson:"state" json:"state"` Notes string `bson:"notes" json:"notes"` PaymentMethod int8 `bson:"paymentMethod" json:"paymentMethod"` PaymentRef string `bson:"paymentRef" json:"paymentRef"` TrackingRef string `bson:"trackingRef" json:"trackingRef"` CreatedAt int32 `bson:"createdAt,omitempty" json:"createdAt"` UpdatedAt int32 `bson:"updatedAt,omitempty" json:"updatedAt"` }
Order definition
func CancelOrder ¶
func ConfirmReceivedOrder ¶
func PrepareOrder ¶
func PurchaseOrder ¶
func (*Order) ConfirmReceived ¶
func (*Order) UpdateState ¶
type Stock ¶
type Stock struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Size string `bson:"size" json:"size"` CreatedAt int32 `bson:"createdAt" json:"createdAt"` }
Stock definition
type StockArticle ¶
type StockOrderArticle ¶
type StockOrderArticle struct { Refs []StockOrderArticleItem `bson:"refs,omitempty" json:"refs,omitempty"` Size string `bson:"size" json:"size"` Count int32 `bson:"count" json:"count"` }
type StockOrderArticleItem ¶
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` Surname string `bson:"surname" json:"surname"` Email string `bson:"email" json:"email"` Phone string `bson:"phone" json:"phone"` Address string `bson:"address" json:"address"` }
User definition
Click to show internal directories.
Click to hide internal directories.