Class PromotionEngine
Evaluates the condition on all active promotions and gives reward to specific orders when the conditions are fulfilled.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Commerce.Marketing
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0Syntax
public class PromotionEngine : IPromotionEngine
Constructors
PromotionEngine(PromotionEngineContentLoader, IRedemptionLimitService, PromotionFilters, PromotionApplicator, ILineItemCalculator, IShippingCalculator, IOrderFormCalculator)
Creates a new instance of a PromotionEngine.
Declaration
[Obsolete("Use the overload with entry filter parameter instead. Will remain at least until Jan 2018.")]
public PromotionEngine(PromotionEngineContentLoader promotionEngineContentLoader, IRedemptionLimitService redemptionLimitService, PromotionFilters promotionFilters, PromotionApplicator promotionExecutor, ILineItemCalculator lineItemCalculator, IShippingCalculator shippingCalculator, IOrderFormCalculator orderFormCalculator)
Parameters
Type | Name | Description |
---|---|---|
PromotionEngineContentLoader | promotionEngineContentLoader | The service used to load existing promotions and other reference data. |
IRedemptionLimitService | redemptionLimitService | The redemption limits service. |
PromotionFilters | promotionFilters | Removes any non available promotions. |
PromotionApplicator | promotionExecutor | Evaluates promotions, applies reward for promotions. |
ILineItemCalculator | lineItemCalculator | The line item calculator. |
IShippingCalculator | shippingCalculator | The shipping calculator. |
IOrderFormCalculator | orderFormCalculator | The order form calculator. |
PromotionEngine(PromotionEngineContentLoader, IRedemptionLimitService, PromotionFilters, PromotionApplicator, ILineItemCalculator, IShippingCalculator, IOrderFormCalculator, IEntryFilter)
Creates a new instance of a PromotionEngine.
Declaration
public PromotionEngine(PromotionEngineContentLoader promotionEngineContentLoader, IRedemptionLimitService redemptionLimitService, PromotionFilters promotionFilters, PromotionApplicator promotionExecutor, ILineItemCalculator lineItemCalculator, IShippingCalculator shippingCalculator, IOrderFormCalculator orderFormCalculator, IEntryFilter entryFilter)
Parameters
Type | Name | Description |
---|---|---|
PromotionEngineContentLoader | promotionEngineContentLoader | The service used to load existing promotions and other reference data. |
IRedemptionLimitService | redemptionLimitService | The redemption limits service. |
PromotionFilters | promotionFilters | Removes any non available promotions. |
PromotionApplicator | promotionExecutor | Evaluates promotions, applies reward for promotions. |
ILineItemCalculator | lineItemCalculator | The line item calculator. |
IShippingCalculator | shippingCalculator | The shipping calculator. |
IOrderFormCalculator | orderFormCalculator | The order form calculator. |
IEntryFilter | entryFilter | The entry filter. |
Methods
ClearPromotionsAndDiscountAmounts(IOrderForm, PromotionProcessorContext)
Clears any existing discount amounts on all ILineItems and IShipment in the order and removes any existing promotions from the IOrderForm.
Declaration
protected virtual void ClearPromotionsAndDiscountAmounts(IOrderForm orderForm, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
IOrderForm | orderForm | The order form holding the promotions to be removed. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
CreatePromotionContext(IOrderGroup, IOrderForm)
Creates the promotion processor context.
Declaration
protected virtual PromotionProcessorContext CreatePromotionContext(IOrderGroup orderGroup, IOrderForm orderForm)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
IOrderForm | orderForm | The order form. |
Returns
Type | Description |
---|---|
PromotionProcessorContext |
Evaluate(IEnumerable<ContentReference>, IMarket, Currency, RequestFulfillmentStatus)
Gets the information about all promotions related to a multiple entries but individually evaluated
Declaration
public IEnumerable<RewardDescription> Evaluate(IEnumerable<ContentReference> entryLinks, IMarket market, Currency currency, RequestFulfillmentStatus requestFulfillmentStatus)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<EPiServer.Core.ContentReference> | entryLinks | The entries to get the promotion information about. |
IMarket | market | The market. |
Currency | currency | The currency. |
RequestFulfillmentStatus | requestFulfillmentStatus | The request fulfillment status. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<RewardDescription> | A list of RewardDescription giving us the reward information associated to the list of EPiServer.Core.ContentReference |
GetCampaignFolderRoot()
Get the link to the campaign folder root.
Declaration
protected virtual ContentReference GetCampaignFolderRoot()
Returns
Type | Description |
---|---|
EPiServer.Core.ContentReference | The content link to the campaign folder root. |
Run(IOrderGroup, PromotionEngineSettings)
Checks the condition for all active promotions, and gives awards for the promotions where the condition has been fulfilled. Promotions with higher priority (lower Priority value) will be evaluated first and all excluded promotions will not be evaluated.
Declaration
public virtual IEnumerable<RewardDescription> Run(IOrderGroup orderGroup, PromotionEngineSettings settings)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group which will receive rewards. |
PromotionEngineSettings | settings | The settings for this run of the engine. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<RewardDescription> |
Remarks
Will return RewardDescriptions that has the same status as any of the RequestedStatuses.