order

package
v0.0.0-...-7544875 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Billing

type Billing struct {
	ID      string
	Name    string
	Address string
}

Billing is data collection for customer billing information

type CustomerDetail

type CustomerDetail struct {
	ID      string
	Name    string
	Address string
}

CustomerDetail defines type of customer detail

type Item

type Item struct {
	ID        string  `json:"id"`
	ShopID    int64   `json:"shop_id"`
	SKU       string  `json:"sku"`
	Name      string  `json:"name"`
	Uom       string  `json:"uom"`
	Qty       int64   `json:"qty"`
	BasePrice float64 `json:"base_price"`
}

Item means the items from order

type ItemDetail

type ItemDetail struct {
	ID       string
	Name     string
	Quantity float64
	Uom      string
	Price    float64
}

ItemDetail defines type of items detail

type Order

type Order struct {
	ID           int32   `json:"id"`
	TrxID        string  `json:"trx_id"`
	PaymentTrxID string  `json:"payment_trx_id"`
	Items        []Item  `json:"items"`
	Billing      Billing `json:"billing"`
	Status       Status  `json:"status"`
}

Order is represent object for creating new order

func (*Order) GenerateID

func (o *Order) GenerateID()

func (*Order) ItemsToJSON

func (o *Order) ItemsToJSON() ([]byte, error)

func (*Order) SetPaymentTrxID

func (o *Order) SetPaymentTrxID(val string)

func (*Order) SetStatus

func (o *Order) SetStatus(val Status)

func (*Order) Validate

func (o *Order) Validate() error

type Payment

type Payment struct {
	TransactionDetail TransactionDetail
	CustomerDetail    CustomerDetail
	ItemDetails       []ItemDetail
}

Payment defines a type of payment service The service should to know what customer order and Locking items before payment

type Status

type Status string
const (
	STATUS_DRAFT    Status = "draft"
	STATUS_PLACED   Status = "placed"
	STATUS_CANCELED Status = "canceled"
)

type TransactionDetail

type TransactionDetail struct {
	TrxID       string
	FinalAmount float64
}

TransactionDetail defines type of transaction detail such as transaction id as a key

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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