Class OrderPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
Abstract base class for an order promotion rule. New order promotion rules should inherit from this class.
To use inbuilt properties, inherit from OrderPromotionRule.
public abstract class OrderPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult> : PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>, IOrderPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule where TPromotionRuleProperties : IPromotionRuleProperties, new() where TPriceCalculationRequest : IPriceCalculationRequest where TPriceCalculationResult : IPriceCalculationResult
Type Parameters
TPromotionRulePropertiesType containing promotion rule properties.
TPriceCalculationRequestPrice calculation request type.
TPriceCalculationResultPrice calculation result type.
- Inheritance
-
objectPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>OrderPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
- Implements
-
IOrderPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>
- Derived
- Inherited Members
- Extension Methods
Constructors
OrderPromotionRuleBase()
protected OrderPromotionRuleBase()
Methods
GetDiscountValueLabel()
Gets a human-readable label representing the discount value for display purposes.
public virtual string GetDiscountValueLabel()
Returns
- string
A formatted string representing the discount value (e.g., "25%" for percentage discounts or "$30.00" for fixed amount discounts). Returns
nullby default if not overridden in derived classes.
Remarks
This method is typically used to populate the display label in promotion candidates, which can be shown to users in the UI. Derived classes should override this method to provide a formatted representation of the discount value based on the promotion rule properties.
GetPromotionCandidate(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>)
Gets the promotion candidate that can be used for the whole order.
public abstract OrderPromotionCandidate GetPromotionCandidate(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult> calculationData)
Parameters
calculationDataIPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>Price calculation data.
Returns
- OrderPromotionCandidate
Promotion candidate with the order promotion amount calculated based on the order total,
nullif the promotion is not applicable for the order.
Remarks
The price calculation service will retrieve all applicable promotion candidates for the order. The best promotion candidate will be applied to the order total. If multiple promotion candidates have the same discount amount, the newly created promotion candidate will be applied.