Documentation ¶
Overview ¶
Package order represents abstraction of business layer purchase order object
Index ¶
- Constants
- func GetItemsForOrders(orderIds []string) []map[string]interface{}
- func GetOrdersCreatedBetween(startDate time.Time, endDate time.Time) []models.StructListItem
- func SplitFullName(name string) (string, string)
- type InterfaceOrder
- type InterfaceOrderCollection
- type InterfaceOrderItem
- type InterfaceOrderItemCollection
- type StructDiscount
- type StructTaxRate
Constants ¶
const ( ConstModelNameOrder = "Order" ConstModelNameOrderCollection = "OrderCollection" ConstModelNameOrderItemCollection = "OrderItemCollection" ConstOrderStatusDeclined = "declined" // order was created and then declined ConstOrderStatusNew = "new" // order created but not paid ConstOrderStatusPending = "pending" // order was submitted and currently in processing ConstOrderStatusProcessed = "processed" // order was authorized and funds collected ConstOrderStatusCompleted = "completed" // order was completed by retailer ConstOrderStatusCancelled = "cancelled" // order was cancelled by retailer ConstErrorModule = "order" ConstErrorLevel = env.ConstErrorLevelModel )
Package global constants
Variables ¶
This section is empty.
Functions ¶
func GetItemsForOrders ¶
GetItemsForOrders Get the relavent order items given a slice of orders
func GetOrdersCreatedBetween ¶
GetOrdersCreatedBetween Get the orders `created_at` a certain date range
func SplitFullName ¶
SplitFullName will take a fullname as a string and split it into first name and last names
Types ¶
type InterfaceOrder ¶
type InterfaceOrder interface { GetItems() []InterfaceOrderItem AddItem(productID string, qty int, productOptions map[string]interface{}) (InterfaceOrderItem, error) RemoveItem(itemIdx int) error RemoveAllItems() error CalculateTotals() error NewIncrementID() error GetIncrementID() string SetIncrementID(incrementID string) error GetSubtotal() float64 GetGrandTotal() float64 GetDiscountAmount() float64 GetTaxAmount() float64 GetShippingAmount() float64 GetTaxes() []StructTaxRate GetDiscounts() []StructDiscount GetShippingAddress() visitor.InterfaceVisitorAddress GetBillingAddress() visitor.InterfaceVisitorAddress GetShippingMethod() string GetPaymentMethod() string GetStatus() string SetStatus(status string) error Proceed() error Rollback() error DuplicateOrder(params map[string]interface{}) (interface{}, error) SendShippingStatusUpdateEmail() error SendOrderConfirmationEmail() error models.InterfaceModel models.InterfaceObject models.InterfaceStorable models.InterfaceListable }
InterfaceOrder represents interface to access business layer implementation of purchase order object
func GetFullOrdersUpdatedBetween ¶
func GetFullOrdersUpdatedBetween(startDate time.Time, endDate time.Time) []InterfaceOrder
GetFullOrdersUpdatedBetween db query for getting all orders, with expensive details
func GetOrderModel ¶
func GetOrderModel() (InterfaceOrder, error)
GetOrderModel retrieves current InterfaceOrder model implementation
func GetOrderModelAndSetID ¶
func GetOrderModelAndSetID(orderID string) (InterfaceOrder, error)
GetOrderModelAndSetID retrieves current InterfaceOrder model implementation and sets its ID to some value
func LoadOrderByID ¶
func LoadOrderByID(orderID string) (InterfaceOrder, error)
LoadOrderByID loads order data into current InterfaceOrder model implementation
type InterfaceOrderCollection ¶
type InterfaceOrderCollection interface { ListOrders() []InterfaceOrder models.InterfaceCollection }
InterfaceOrderCollection represents interface to access business layer implementation of purchase order collection
func GetOrderCollectionModel ¶
func GetOrderCollectionModel() (InterfaceOrderCollection, error)
GetOrderCollectionModel retrieves current InterfaceOrderCollection model implementation
type InterfaceOrderItem ¶
type InterfaceOrderItem interface { GetID() string SetID(newID string) error GetProductID() string GetName() string GetSku() string GetQty() int GetPrice() float64 GetWeight() float64 GetOptions() map[string]interface{} GetOptionValues(labels bool) map[string]interface{} models.InterfaceObject }
InterfaceOrderItem represents interface to access business layer implementation of purchase order item object
type InterfaceOrderItemCollection ¶
type InterfaceOrderItemCollection interface { models.InterfaceCollection }
InterfaceOrderItemCollection represents interface to access business layer implementation of purchase order item collection
func GetOrderItemCollectionModel ¶
func GetOrderItemCollectionModel() (InterfaceOrderItemCollection, error)
GetOrderItemCollectionModel retrieves current InterfaceOrderCollection model implementation
type StructDiscount ¶
StructDiscount represents type to hold discount information generated by implementation of InterfaceDiscount
type StructTaxRate ¶
StructTaxRate represents type to hold tax rate information generated by implementation of InterfaceTax