Promotion Action
PromotionAction
An abstract class which is extended by PromotionItemAction, PromotionOrderAction, and PromotionShippingAction.
- Extends:
ConfigurableOperationDef<T>
priorityValue
number0Used to determine the order of application of multiple Promotions
on the same Order. See the Promotion priorityScore field for
more information.
PromotionItemAction
Represents a PromotionAction which applies to individual OrderLines.
Example
- Extends:
PromotionAction<T, U>
PromotionOrderAction
Represents a PromotionAction which applies to the Order as a whole.
Example
- Extends:
PromotionAction<T, U>
PromotionShippingAction
Represents a PromotionAction which applies to the shipping cost of an Order.
- Extends:
PromotionAction<T, U>
ExecutePromotionItemActionFn
The function which is used by a PromotionItemAction to calculate the discount on the OrderLine for each item.
ExecutePromotionLineActionFn
The function which is used by a PromotionLineAction to calculate the discount on the OrderLine.
ExecutePromotionOrderActionFn
The function which is used by a PromotionOrderAction to calculate the discount on the Order.
ExecutePromotionShippingActionFn
The function which is used by a PromotionOrderAction to calculate the discount on the Order.
PromotionActionSideEffectFn
The signature of a PromotionAction's side-effect functions onActivate and onDeactivate.
PromotionActionConfig
Configuration for all types of PromotionAction.
- Extends:
ConfigurableOperationDefOptions<T>
priorityValue
number0Used to determine the order of application of multiple Promotions
on the same Order. See the Promotion priorityScore field for
more information.
conditions
U extends undefined ? undefined : ConditionTuple<Exclude<U, undefined>>Allows PromotionActions to define one or more PromotionConditions as dependencies. Having a PromotionCondition as a dependency has the following consequences:
- A Promotion using this PromotionAction is only valid if it also contains all PromotionConditions on which it depends.
- The
execute()function will receive a statically-typedstateargument which will contain the return values of the PromotionConditions'check()function.
onActivate
An optional side effect function which is invoked when the promotion becomes active. It can be used for things like adding a free gift to the order or other side effects that are unrelated to price calculations.
If used, make sure to use the corresponding onDeactivate function to clean up
or reverse any side effects as needed.
onDeactivate
Used to reverse or clean up any side effects executed as part of the onActivate function.
PromotionItemActionConfig
Configuration for a PromotionItemAction
- Extends:
PromotionActionConfig<T, U>
execute
ExecutePromotionItemActionFn<T, U>The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the OrderLine, i.e. the number should be negative.
PromotionLineActionConfig
Configuration for a PromotionLineAction
- Extends:
PromotionActionConfig<T, U>
execute
ExecutePromotionLineActionFn<T, U>The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the OrderLine, i.e. the number should be negative.
PromotionOrderActionConfig
- Extends:
PromotionActionConfig<T, U>
execute
ExecutePromotionOrderActionFn<T, U>The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the Order, i.e. the number should be negative.
PromotionShippingActionConfig
- Extends:
PromotionActionConfig<T, U>
execute
ExecutePromotionShippingActionFn<T, U>The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the Shipping, i.e. the number should be negative.
PromotionLineAction
Represents a PromotionAction which applies to individual OrderLines. The difference from PromotionItemAction is that it applies regardless of the Quantity of the OrderLine.
Example
- Extends:
PromotionAction<T, U>