Class PromotionProcessorBase<TPromotionData>
Responsible for evaluating if a promotion is valid for a specific IOrderForm.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Commerce.Marketing
Assembly: EPiServer.Business.Commerce.dll
Version: 9.24.1Syntax
[CLSCompliant(false)]
public abstract class PromotionProcessorBase<TPromotionData> : IPromotionProcessor where TPromotionData : PromotionData
Type Parameters
| Name | Description |
|---|---|
| TPromotionData |
Constructors
PromotionProcessorBase()
Declaration
protected PromotionProcessorBase()
Properties
Priority
Gets the priority of this processor. In case there are multiple processors which can handle a promotion, the one with highest priority will be used.
Declaration
public virtual int Priority { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
PromotionDataType
The type this processor can handle.
Declaration
public Type PromotionDataType { get; }
Property Value
| Type | Description |
|---|---|
| System.Type |
Methods
CanBeFulfilled(TPromotionData, PromotionProcessorContext)
Verify that the current promotion can potentially be fulfilled
Declaration
protected abstract bool CanBeFulfilled(TPromotionData promotionData, PromotionProcessorContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| TPromotionData | promotionData | The promotion to evaluate. |
| PromotionProcessorContext | context | The context for the promotion processor evaluation. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
This method is intended to be a very quick pre-check to avoid doing more expensive operations. Used to verify basic things, for example a Buy-3-pay-for-2 promotion needs at least three items in the cart. If we have less than three we can skip further processing.
Evaluate(TPromotionData, PromotionProcessorContext)
Evaluates a promotion against an order form. Implementations should use context.OrderForm for evaluations.
Declaration
protected abstract RewardDescription Evaluate(TPromotionData promotionData, PromotionProcessorContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| TPromotionData | promotionData | The promotion to evaluate. |
| PromotionProcessorContext | context | The context for the promotion processor evaluation. |
Returns
| Type | Description |
|---|---|
| RewardDescription | A RewardDescription telling whether the promotion was fulfilled, which items the promotion was applied to and to which amount. |
Evaluate(PromotionData, PromotionProcessorContext)
Evaluates a promotion. Implementations should use context.OrderForm when evaluating promotions
Declaration
public virtual RewardDescription Evaluate(PromotionData promotionData, PromotionProcessorContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| PromotionData | promotionData | The promotion model. |
| PromotionProcessorContext | context | The context for the promotion processor evaluation. |
Returns
| Type | Description |
|---|---|
| RewardDescription | The reward for a promotion. |
Remarks
Any implementation of this that applies to a PromotionData that has an System.Collections.Generic.IList<T> property must consider and plan for values where the amount might be zero for some or all currencies.
GetLineItems(IOrderForm)
Get all line items included in an order form, except gift items.
Declaration
public virtual IEnumerable<ILineItem> GetLineItems(IOrderForm orderForm)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ILineItem> | All line items included in the specified order form. |
GetPromotionItems(TPromotionData)
Gets the items for a promotion.
Declaration
protected abstract PromotionItems GetPromotionItems(TPromotionData promotionData)
Parameters
| Type | Name | Description |
|---|---|---|
| TPromotionData | promotionData | The promotion data to get items for. |
Returns
| Type | Description |
|---|---|
| PromotionItems | The promotion condition and reward items. |
GetPromotionItems(PromotionData)
Gets the items for a promotion.
Declaration
public virtual PromotionItems GetPromotionItems(PromotionData promotionData)
Parameters
| Type | Name | Description |
|---|---|---|
| PromotionData | promotionData | The promotion data to get items for. |
Returns
| Type | Description |
|---|---|
| PromotionItems | The promotion condition and reward items. |
NotFulfilledRewardDescription(TPromotionData, PromotionProcessorContext, FulfillmentStatus)
Not fulfilled reward description. Will be returned when CanBeFulfilled is false.
Declaration
protected virtual RewardDescription NotFulfilledRewardDescription(TPromotionData promotionData, PromotionProcessorContext context, FulfillmentStatus fulfillmentStatus)
Parameters
| Type | Name | Description |
|---|---|---|
| TPromotionData | promotionData | The promotion that was evaluated. |
| PromotionProcessorContext | context | The context for the promotion processor evaluation. |
| FulfillmentStatus | fulfillmentStatus | The fulfillment level of the promotion. |
Returns
| Type | Description |
|---|---|
| RewardDescription | A RewardDescription for the not fulfilled promotion. |