PromotionCondition

PromotionCondition

PromotionConditions are used to create Promotions. The purpose of a PromotionCondition is to check the order against a particular predicate function (the check function) and to return true if the Order satisfies the condition, or false if it does not.

Signature

class PromotionCondition<T extends PromotionConditionArgs = {}> implements ConfigurableOperationDef {
  readonly code: string;
  readonly description: string;
  readonly args: PromotionConditionArgs;
  readonly priorityValue: number;
  constructor(config: {
        args: T;
        check: CheckPromotionConditionFn<T>;
        code: string;
        description: string;
        priorityValue?: number;
    })
  check(order: Order, args: ConfigArg[], utils: PromotionUtils) => Promise<boolean>;
}

Members

code

property
type:
string

description

property
type:
string

args

property
type:
PromotionConditionArgs

priorityValue

property
type:
number

constructor

method
type:
(config: { args: T; check: CheckPromotionConditionFn<T>; code: string; description: string; priorityValue?: number; }) => PromotionCondition

check

method
type:
(order: Order, args: ConfigArg[], utils: PromotionUtils) => Promise<boolean>
alpha