Type Alias: LineItemContext
type LineItemContext = {
base_price_cents?: number;
module: string;
pricing_unit: string;
rate_tier_id?: string;
};Defined in: shared/pricing/types/context.ts:40
Minimal line-item contract. module is the universal pricing-domain
discriminator and the only field the built-in PRICING_SCOPES
reads. base_price_cents and pricing_unit are pricing-domain
primitives the future calculatePrices step will consume.
base_price_cents is optional. The field exists as a migration affordance
for consumer apps that already store base prices on their own catalog and
don't want to re-author them as rules — those apps populate it from their
existing data so calculatePrices can start from a base. Greenfield
consumers should omit it and instead author the base price as a rule
(a base-phase action), so the engine is the single source of truth for
pricing. When omitted, calculatePrices will derive the base from the
matched base-phase rules and fall back to 0 if none match.
Consuming apps extend this shape with their product-specific fields
(e.g. facility_id, household_member, reservation) and wire
those into their own scope mapping. The engine accepts any superset
of this contract — see EvaluatePricingContext below for how it's
threaded through via a generic TContext.
Extended by
Properties
base_price_cents?
optional base_price_cents?: number;Defined in: shared/pricing/types/context.ts:42
module
module: string;Defined in: shared/pricing/types/context.ts:41
pricing_unit
pricing_unit: string;Defined in: shared/pricing/types/context.ts:48
rate_tier_id?
optional rate_tier_id?: string;Defined in: shared/pricing/types/context.ts:58
The pricing-matrix rate tier (PLA-136) this line declares itself as.
Wired into PRICING_SCOPES.line_items as the rate_tier_id scope
type, so a matrix cell Rule's exclusive rate_tier_id scope entry
(injected by PricingMatrixService.addRateTier) matches by default —
without this field, evaluatePricing would never select a tier's
cell rules for a line. Optional because lines outside the matrix
(ordinary authored rules, no tiers involved) simply omit it.