Pricing
Overview
The Pricing
types are discriminated unions of possible pricing structures.
This enables a variety of UI treatments, such as price ranges, strikethrough prices, promotional messaging, and unknown prices.
// When it will always be a single price
type Pricing =
UnknownPrice
| PromotionPrice
| SalePrice
| ListPrice
// Pricing for a product that has not been narrowed down to a single
// purchasable unit, e.g, [`ContainerProduct](./ContainerProduct), and the price may be a range.
type ProductPricing =
UnknownPrice
| PromotionPrice
| SalePrice
| ListPrice
| RangePrice
// When it must be a single, known price, such as on orders
type KnownPricing =
PromotionPrice
| SalePrice
| ListPrice
UnknownPrice
Attributes
type
type: literal = 'unknown'
Currently unknown price
PromotionPrice
Attributes
type
type: literal = 'promotion'
originalPrice
type: Money
The money amount prior to the applied promotion
finalPrice
type: Money
The money value after the applied promotion. The money value that will be paid.
promotion
type: Promotion
The promotion affecting this price.
SalePrice
Attributes
type
type: literal = 'sale'
originalPrice
type: Money
finalPrice
type: Money
The sale price money value. The money value that will be paid.
ListPrice
Attributes
type
type: literal = 'list'
finalPrice
type: string
The money value that will be paid.
RangePrice
Attributes
type
type: literal = 'range'
min
type: Money
The minimum money value for the range.
max
type: Money