Kaizen
Browse modulesPricingpricing/sharedTypes

Type Alias: ConditionQualification

type ConditionQualification = {
  qualifying_quantity: number;
  qualifying_sub_units: SubUnit[];
  total_sub_units: number;
};

Defined in: shared/pricing/types/sub-unit.ts:55

Per-rule qualification produced by resolvePerUnitQualification and attached to each line-level MatchedPricingRule before the calculator runs.

The calculator reads qualifying_quantity / total_sub_units as the ratio for percentage-action qualifying-share, and — only when the line decomposed into more than one sub-unit — qualifying_quantity as the multiplier for per_unit flat-action scaling. A total_sub_units of 1 is the atomic/whole-line shape: it says whether the line qualifies, not how many of its units do, so the calculator scales by the line's full quantity there (see resolveScalingQuantity). Same fallback when qualification is absent entirely (order-level rules, base-phase rules).

Properties

qualifying_quantity

qualifying_quantity: number;

Defined in: shared/pricing/types/sub-unit.ts:60

Number of enumerated sub-units that satisfy the rule's condition_logic tree. Always <= total_sub_units.


qualifying_sub_units

qualifying_sub_units: SubUnit[];

Defined in: shared/pricing/types/sub-unit.ts:72

The qualifying sub-units themselves, in enumerator order. Surfaced so invoice renderers and audit logs can show which sub-units a rule applied to (e.g. "$15 weekend surcharge — Sat Jul 11, Sun Jul 12").


total_sub_units

total_sub_units: number;

Defined in: shared/pricing/types/sub-unit.ts:65

Total enumerated sub-units for the line. Denominator for percentage qualifying-share ratios.

On this page