models

package
v0.0.0-...-c5ca1f7 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT-0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrProcessOrder

type ErrProcessOrder struct {
	// contains filtered or unexported fields
}

ErrProcessOrder represents a process order error

func NewErrProcessOrder

func NewErrProcessOrder(message string) *ErrProcessOrder

NewErrProcessOrder constructor

func (*ErrProcessOrder) Error

func (e *ErrProcessOrder) Error() string

type ErrProcessPayment

type ErrProcessPayment struct {
	// contains filtered or unexported fields
}

ErrProcessPayment represents a process payment error

func NewErrProcessPayment

func NewErrProcessPayment(message string) *ErrProcessPayment

NewErrProcessPayment constructor

func (*ErrProcessPayment) Error

func (e *ErrProcessPayment) Error() string

type ErrProcessRefund

type ErrProcessRefund struct {
	// contains filtered or unexported fields
}

ErrProcessRefund represents a process payment refund error

func NewErrProcessRefund

func NewErrProcessRefund(message string) *ErrProcessRefund

NewErrProcessRefund constructor

func (*ErrProcessRefund) Error

func (e *ErrProcessRefund) Error() string

type ErrReleaseInventory

type ErrReleaseInventory struct {
	// contains filtered or unexported fields
}

ErrReleaseInventory represents a inventory update reversal error

func NewErrReleaseInventory

func NewErrReleaseInventory(message string) *ErrReleaseInventory

NewErrReleaseInventory constructor

func (*ErrReleaseInventory) Error

func (e *ErrReleaseInventory) Error() string

type ErrReserveInventory

type ErrReserveInventory struct {
	// contains filtered or unexported fields
}

ErrReserveInventory represents a inventory update error

func NewErrReserveInventory

func NewErrReserveInventory(message string) *ErrReserveInventory

NewErrReserveInventory constructor

func (*ErrReserveInventory) Error

func (e *ErrReserveInventory) Error() string

type ErrUpdateOrderStatus

type ErrUpdateOrderStatus struct {
	// contains filtered or unexported fields
}

ErrUpdateOrderStatus represents a process order error

func NewErrUpdateOrderStatus

func NewErrUpdateOrderStatus(message string) *ErrUpdateOrderStatus

NewErrUpdateOrderStatus constructor

func (*ErrUpdateOrderStatus) Error

func (e *ErrUpdateOrderStatus) Error() string

type Inventory

type Inventory struct {
	TransactionID   string   `json:"transaction_id,omitempty"`
	TransactionDate string   `json:"transaction_date,omitempty"`
	OrderID         string   `json:"order_id,omitempty"`
	OrderItems      []string `json:"items,omitempty"`
	TransactionType string   `json:"transaction_type,omitempty"`
}

Inventory represents the transaction on inventory

func (*Inventory) Release

func (i *Inventory) Release()

Release method makes items from the inventory available

func (*Inventory) Reserve

func (i *Inventory) Reserve()

Reserve method removes items from the inventory

type Item

type Item struct {
	ItemID      string  `json:"item_id,omitempty"`
	Qty         float64 `json:"qty,omitempty"`
	Description string  `json:"description,omitempty"`
	UnitPrice   float64 `json:"unit_price,omitempty"`
}

Item represents an item in the cart

type Order

type Order struct {
	OrderID     string    `json:"order_id,omitempty"`
	OrderDate   time.Time `json:"order_date,omitempty"`
	CustomerID  string    `json:"customer_id,omitempty"`
	OrderStatus string    `json:"order_status,omitempty"`
	Items       []Item    `json:"items,omitempty"`
	Payment     Payment   `json:"payment,omitempty"`
	Inventory   Inventory `json:"inventory,omitempty"`
}

Order represents a customer order

func (Order) ItemIds

func (o Order) ItemIds() []string

ItemIds returns a slice of Ids or Items in the order

func (Order) Total

func (o Order) Total() float64

Total returns the total ammount of the order

type Payment

type Payment struct {
	MerchantID      string  `json:"merchant_id,omitempty"`
	PaymentAmount   float64 `json:"payment_amount,omitempty"`
	TransactionID   string  `json:"transaction_id,omitempty"`
	TransactionDate string  `json:"transaction_date,omitempty"`
	OrderID         string  `json:"order_id,omitempty"`
	PaymentType     string  `json:"payment_type,omitempty"`
}

Payment represents a customer credit card payment

func (*Payment) Pay

func (p *Payment) Pay()

Pay customer order payment

func (*Payment) Refund

func (p *Payment) Refund()

Refund customer order

Jump to

Keyboard shortcuts

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