Kaizen
Browse modulesPricingpricing/serverTypes

Type Alias: EvaluatePricingOptions<TContext *extends* [`EvaluatePricingContext`](../../shared/type-aliases/EvaluatePricingContext.md)>

type EvaluatePricingOptions<TContext extends EvaluatePricingContext> = {
  context: TContext;
  customConditions?: CustomConditionDef<unknown, TContext>[];
  enumerateSubUnits?: EnumerateSubUnits<TContext["line_items"][number]>;
  getQuantity?: GetQuantity<TContext>;
  organizationId: string;
  scopes?: PricingScopeMapping<TContext>;
};

Defined in: server/pricing/evaluate-pricing.ts:32

Type Parameters

Type Parameter
TContext extends EvaluatePricingContext

Properties

context

context: TContext;

Defined in: server/pricing/evaluate-pricing.ts:33


customConditions?

optional customConditions?: CustomConditionDef<unknown, TContext>[];

Defined in: server/pricing/evaluate-pricing.ts:50


enumerateSubUnits?

optional enumerateSubUnits?: EnumerateSubUnits<TContext["line_items"][number]>;

Defined in: server/pricing/evaluate-pricing.ts:71

Optional override of the default sub-unit enumerator used by the per-unit qualification pass. The default decomposes time-shaped pricing_units (night, day, hour, month, year) along the union of date-range-declaring conditions found on the line's matched rules. Supply this to decompose along a non-time axis (e.g. one sub-unit per roster member for pricing_unit: "person") or to handle non-canonical units.


getQuantity?

optional getQuantity?: GetQuantity<TContext>;

Defined in: server/pricing/evaluate-pricing.ts:61

Resolves the quantity multiplier for a line item — needed for any pricing_unit outside of "unit" / "flat" (e.g. "night", "hour", "day", "person"). The calculator throws MissingQuantityResolverError when such a line is encountered without this option. For "unit" lines the resolver is consulted when present (e.g. tickets that carry quantity on the line item) and defaults to 1 otherwise. For "flat" lines it is never consulted: a fixed amount is charged once per line (PLA-276).


organizationId

organizationId: string;

Defined in: server/pricing/evaluate-pricing.ts:34


scopes?

optional scopes?: PricingScopeMapping<TContext>;

Defined in: server/pricing/evaluate-pricing.ts:49

Typed, section-rooted scope mapping. Each top-level key names a section of the context (line_items, order, …) and each inner path is rooted in that section — e.g. the scope on a line item's facility_id is authored as facility_id, not line_items.*.facility_id.

Implicitly merged on top of the package's built-in PRICING_SCOPES, which already supplies the universal pricing primitives (module, discount_codes). Consumers only declare their product-specific scopes here — the universals are added in for free. On path collisions, the consumer's value wins, so apps with a different field name for module or discount_codes can still override.

On this page