Documentation
¶
Index ¶
Constants ¶
View Source
const ( NUMBER = iota STRING BOOL )
NUMBER|STRING|BOOL are the different types supported in custom data for orders
View Source
const PaidState = "paid"
View Source
const PendingState = "pending"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶
type Address struct { ID string `json:"id"` User *User `json:"-"` UserID string `json:"-"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Company string `json:"company"` Address1 string `json:"address1"` Address2 string `json:"address2"` City string `json:"city"` Country string `json:"country"` State string `json:"state"` Zip string `json:"zip"` CreatedAt time.Time `json:"created_at"` DeletedAt *time.Time `json:"deleted_at"` }
type Configuration ¶
Configuration defines the info necessary to connect to a storage engine
type Data ¶
type Data struct { OrderID string `gorm:"primary_key"` Key string `gorm:"primary_key"` Type int NumericValue float64 StringValue string BoolValue bool }
Data is the custom data on an Order
type InvalidDataType ¶
type InvalidDataType struct {
Key string
}
InvalidDataType is an error returned when trying to set an invalid datatype for a user data key
func (*InvalidDataType) Error ¶
func (i *InvalidDataType) Error() string
type LineItem ¶
type LineItem struct { ID int64 `json:"id"` OrderID string `json:"-"` Title string `json:"title"` SKU string `json:"sku"` Type string `json:"type"` Description string `json:"description"` VAT uint64 `json:"vat"` Path string `json:"path"` Price uint64 `json:"price"` Quantity uint64 `json:"quantity"` CreatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` }
type LineItemMetadata ¶
type Order ¶
type Order struct { ID string `json:"id"` User *User `json:"user,omitempty"` UserID string `json:"user_id,omitempty"` SessionID string `json:"-"` Email string `json:"email"` LineItems []*LineItem `json:"line_items"` Currency string `json:"currency"` Taxes uint64 `json:"taxes"` Shipping uint64 `json:"shipping"` SubTotal uint64 `json:"subtotal"` Total uint64 `json:"total"` PaymentState string `json:"payment_state"` FulfillmentState string `json:"fulfillment_state"` State string `json:"state"` Transactions []*Transaction `json:"transactions"` Notes []*OrderNote `json:"notes"` ShippingAddress Address `json:"shipping_address",gorm:"ForeignKey:ShippingAddressID"` ShippingAddressID string BillingAddress Address `json:"billing_address",gorm:"ForeignKey:BillingAddressID"` BillingAddressID string VATNumber string `json:"vatnumber"` Data []Data `json:"-"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `json:"-",sql:"index"` }
func (*Order) CalculateTotal ¶
func (o *Order) CalculateTotal(settings *SiteSettings)
func (*Order) MarshalJSON ¶
MarshalJSON is a custom JSON marshaller for Users
type PriceMetadata ¶
type SiteSettings ¶
type SiteSettings struct {
Taxes []*Tax `json:"taxes"`
}
type Transaction ¶
type Transaction struct { ID string `json:"id"` Order *Order `json:"-"` OrderID string `json:"order_id"` ProcessorID string `json:"processor_id"` User *User `json:"-"` UserID string `json:"user_id"` Amount uint64 `json:"amount"` AmountReversed uint64 `json:"amount_reversed"` Currency string `json:"currency"` FailureCode string `json:"failure_code"` FailureDescription string `json:"failure_description"` Status string `json:"status"` Type string `json:"type"` CreatedAt time.Time `json:"created_at"` DeletedAt *time.Time `json:"-"` }
Transaction is an transaction with a payment provider
func NewTransaction ¶
func NewTransaction(order *Order) *Transaction
NewTransaction returns a new transaction for an order
Click to show internal directories.
Click to hide internal directories.