models

package
v0.0.0-...-9123e61 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Basket

type Basket struct {
	Id    uuid.UUID                 `json:"id"`
	Items map[uuid.UUID]*BasketItem `json:"items"`
	State BasketState               `json:"state"`
}

Basket represents a record of the items that customer have chosen to buy

func (*Basket) String

func (basket *Basket) String() string

type BasketItem

type BasketItem struct {
	*SaleItem

	Count int `json:"count"`
}

func (*BasketItem) Print

func (bi *BasketItem) Print() string

func (*BasketItem) String

func (bi *BasketItem) String() string

func (*BasketItem) TotalGross

func (bi *BasketItem) TotalGross() decimal.Decimal

func (*BasketItem) TotalPrice

func (bi *BasketItem) TotalPrice() decimal.Decimal

func (*BasketItem) TotalTax

func (bi *BasketItem) TotalTax() decimal.Decimal

type BasketState

type BasketState string
const (
	BasketStateOpened    BasketState = "OPENED"
	BasketStateClosed    BasketState = "CLOSED"
	BasketStateCancelled BasketState = "CANCELLED"
)

type Category

type Category struct {
	Id   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

Category is used to define if an item is suitable for billing or pricing.

func (*Category) String

func (c *Category) String() string

type InventoryItem

type InventoryItem struct {
	Id         uuid.UUID       `json:"id"`
	Name       string          `json:"name"`
	CategoryId uuid.UUID       `json:"category"`
	Origin     ItemOrigin      `json:"origin"`
	Price      decimal.Decimal `json:"price"`
}

InventoryItem represents the physical good available

func (*InventoryItem) String

func (i *InventoryItem) String() string

type ItemOrigin

type ItemOrigin string
const (
	ItemOriginImported ItemOrigin = "IMPORT"
	ItemOriginLocal    ItemOrigin = "LOCAL"
)

func (*ItemOrigin) UnmarshalText

func (io *ItemOrigin) UnmarshalText(b []byte) error

type Receipt

type Receipt struct {
	Id uuid.UUID `json:"id"`

	Items      []*BasketItem   `json:"items"`
	TotalTax   decimal.Decimal `json:"total_tax"`
	TotalPrice decimal.Decimal `json:"total_price"`
	TotalGross decimal.Decimal `json:"total_gross"`
	// contains filtered or unexported fields
}

Receipt represents written acknowledgment that something of value has been received.

func (*Receipt) Print

func (r *Receipt) Print()

func (*Receipt) String

func (r *Receipt) String() string

type SaleItem

type SaleItem struct {
	*InventoryItem

	Taxes decimal.Decimal `json:"taxes"`
	Gross decimal.Decimal `json:"gross"`
}

func (*SaleItem) String

func (si *SaleItem) String() string

type Tax

type Tax struct {
	Id         uuid.UUID          `json:"id"`
	Name       string             `json:"name"`
	Rate       decimal.Decimal    `json:"rate"`
	Origin     TaxOrigin          `json:"origin"`
	Condition  TaxCondition       `json:"condition"`
	Categories map[uuid.UUID]bool `json:"categories"`
}

Tax

func (*Tax) String

func (t *Tax) String() string

type TaxCondition

type TaxCondition string

TaxCondition is defines category given in tax subject or exempt from tax.

const (
	UnknownTC    TaxCondition = "UNKNOWN"
	ExemptToTax  TaxCondition = "EXEMPT"  // refers to only tax types in context will be free from tax
	SubjectToTax TaxCondition = "SUBJECT" // refers to only tax types in context will be effected from tax
)

func (*TaxCondition) UnmarshalText

func (tc *TaxCondition) UnmarshalText(b []byte) error

type TaxOrigin

type TaxOrigin string

TaxOrigin is defines tax scope according to inventory item origin

const (
	TaxOriginAll    TaxOrigin = "ALL"
	TaxOriginLocal  TaxOrigin = "LOCAL"
	TaxOriginImport TaxOrigin = "IMPORT"
)

func (*TaxOrigin) UnmarshalText

func (tt *TaxOrigin) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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