Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coupon ¶
type Coupon interface {
ValidForType(string) bool
ValidForPrice(string, uint64) bool
PercentageDiscount() uint64
FixedDiscount(string) uint64
}
Coupon is the interface for a coupon needed to do price calculation.
type FixedMemberDiscount ¶
FixedMemberDiscount represents a fixed discount given to members.
type Item ¶
type Item interface {
PriceInLowestUnit() uint64
ProductType() string
FixedVAT() uint64
TaxableItems() []Item
GetQuantity() uint64
}
Item is the interface for a single line item needed to do price calculation.
type MemberDiscount ¶
type MemberDiscount struct {
Claims map[string]string `json:"claims"`
Percentage uint64 `json:"percentage"`
FixedAmount []*FixedMemberDiscount `json:"fixed"`
ProductTypes []string `json:"product_types"`
}
MemberDiscount represents a discount given to members, either fixed or a percentage.
func (*MemberDiscount) FixedDiscount ¶
func (d *MemberDiscount) FixedDiscount(currency string) uint64
FixedDiscount returns what the fixed discount amount is for a particular currency.
func (*MemberDiscount) ValidForType ¶
func (d *MemberDiscount) ValidForType(productType string) bool
ValidForType returns whether a member discount is valid for a product type.
type Settings ¶
type Settings struct {
PricesIncludeTaxes bool `json:"prices_include_taxes"`
Taxes []*Tax `json:"taxes"`
MemberDiscounts []*MemberDiscount `json:"member_discounts"`
}
Settings represent the site-wide settings for price calculation.
Click to show internal directories.
Click to hide internal directories.