Class PromotionProcessorContext
Context object passed into promotion processors and reward applicators, which contains discount information about the affected items.
Inheritance
Inherited Members
Namespace: EPiServer.Commerce.Marketing
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0Syntax
public class PromotionProcessorContext
Constructors
PromotionProcessorContext(IOrderGroup, IOrderForm, ILineItemCalculator, IReturnLineItemCalculator, IOrderFormCalculator, IShippingCalculator)
Declaration
[Obsolete("This constructor is no longer used, use the one with IMarketService instead. Will remain at least until May 2019.")]
public PromotionProcessorContext(IOrderGroup orderGroup, IOrderForm orderForm, ILineItemCalculator lineItemCalculator, IReturnLineItemCalculator returnLineItemCalculator, IOrderFormCalculator orderFormCalculator, IShippingCalculator shippingCalculator)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | |
IOrderForm | orderForm | |
ILineItemCalculator | lineItemCalculator | |
IReturnLineItemCalculator | returnLineItemCalculator | |
IOrderFormCalculator | orderFormCalculator | |
IShippingCalculator | shippingCalculator |
PromotionProcessorContext(IOrderGroup, IOrderForm, ILineItemCalculator, IReturnLineItemCalculator, IOrderFormCalculator, IShippingCalculator, PromotionEngineContentLoader, ContentReference)
Declaration
[Obsolete("This constructor is no longer used, use the one with IMarketService instead. Will remain at least until May 2019.")]
public PromotionProcessorContext(IOrderGroup orderGroup, IOrderForm orderForm, ILineItemCalculator lineItemCalculator, IReturnLineItemCalculator returnLineItemCalculator, IOrderFormCalculator orderFormCalculator, IShippingCalculator shippingCalculator, PromotionEngineContentLoader promotionEngineContentLoader, ContentReference campaignRootLink)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | |
IOrderForm | orderForm | |
ILineItemCalculator | lineItemCalculator | |
IReturnLineItemCalculator | returnLineItemCalculator | |
IOrderFormCalculator | orderFormCalculator | |
IShippingCalculator | shippingCalculator | |
PromotionEngineContentLoader | promotionEngineContentLoader | |
EPiServer.Core.ContentReference | campaignRootLink |
PromotionProcessorContext(IOrderGroup, IOrderForm, ILineItemCalculator, IReturnLineItemCalculator, IOrderFormCalculator, IShippingCalculator, IMarketService)
Creates an instance of a PromotionProcessorContext.
Declaration
public PromotionProcessorContext(IOrderGroup orderGroup, IOrderForm orderForm, ILineItemCalculator lineItemCalculator, IReturnLineItemCalculator returnLineItemCalculator, IOrderFormCalculator orderFormCalculator, IShippingCalculator shippingCalculator, IMarketService marketService)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group that is evaluated. |
IOrderForm | orderForm | The order form. |
ILineItemCalculator | lineItemCalculator | The line item calculator |
IReturnLineItemCalculator | returnLineItemCalculator | The return line item calculator. |
IOrderFormCalculator | orderFormCalculator | The order form calculator. |
IShippingCalculator | shippingCalculator | The shipping calculator. |
IMarketService | marketService | The market service. |
PromotionProcessorContext(IOrderGroup, IOrderForm, ILineItemCalculator, IReturnLineItemCalculator, IOrderFormCalculator, IShippingCalculator, IMarketService, PromotionEngineContentLoader, ContentReference)
Creates an instance of a PromotionProcessorContext.
Declaration
public PromotionProcessorContext(IOrderGroup orderGroup, IOrderForm orderForm, ILineItemCalculator lineItemCalculator, IReturnLineItemCalculator returnLineItemCalculator, IOrderFormCalculator orderFormCalculator, IShippingCalculator shippingCalculator, IMarketService marketService, PromotionEngineContentLoader promotionEngineContentLoader, ContentReference campaignRootLink)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group that is evaluated. |
IOrderForm | orderForm | The order form. |
ILineItemCalculator | lineItemCalculator | The line item calculator |
IReturnLineItemCalculator | returnLineItemCalculator | The return line item calculator. |
IOrderFormCalculator | orderFormCalculator | The order form calculator. |
IShippingCalculator | shippingCalculator | The shipping calculator. |
IMarketService | marketService | The market service. |
PromotionEngineContentLoader | promotionEngineContentLoader | The promotion engine content loader. |
EPiServer.Core.ContentReference | campaignRootLink | The campaign root link. |
PromotionProcessorContext(IOrderGroup, IOrderForm, ILineItemCalculator, IReturnLineItemCalculator, IOrderFormCalculator, IShippingCalculator, IMarketService, PromotionEngineContentLoader, ContentReference, Func<PromotionData, Int32>)
Creates an instance of a PromotionProcessorContext.
Declaration
public PromotionProcessorContext(IOrderGroup orderGroup, IOrderForm orderForm, ILineItemCalculator lineItemCalculator, IReturnLineItemCalculator returnLineItemCalculator, IOrderFormCalculator orderFormCalculator, IShippingCalculator shippingCalculator, IMarketService marketService, PromotionEngineContentLoader promotionEngineContentLoader, ContentReference campaignRootLink, Func<PromotionData, int> remainingRedemptions)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group that is evaluated. |
IOrderForm | orderForm | The order form. |
ILineItemCalculator | lineItemCalculator | The line item calculator |
IReturnLineItemCalculator | returnLineItemCalculator | The return line item calculator. |
IOrderFormCalculator | orderFormCalculator | The order form calculator. |
IShippingCalculator | shippingCalculator | The shipping calculator. |
IMarketService | marketService | The market service. |
PromotionEngineContentLoader | promotionEngineContentLoader | The promotion engine content loader. |
EPiServer.Core.ContentReference | campaignRootLink | The campaign root link. |
System.Func<PromotionData, System.Int32> | remainingRedemptions | A func that returns the number of remaining redemptions. |
Properties
CurrentOrderFormSubTotal
Gets the current order form subtotal that the promotion engine is processing at the time. This is calculated before every promotion has been evaluated.
Declaration
public decimal CurrentOrderFormSubTotal { get; }
Property Value
Type | Description |
---|---|
System.Decimal |
EntryPrices
Gets the price matrix for entries. Used to get the current state of prices for the line items. May change as more promotions are applied.
Declaration
public OrderFormPriceMatrix EntryPrices { get; }
Property Value
Type | Description |
---|---|
OrderFormPriceMatrix |
OrderForm
Gets the order form.
Declaration
public IOrderForm OrderForm { get; }
Property Value
Type | Description |
---|---|
IOrderForm |
OrderGroup
Gets the order group.
Declaration
public IOrderGroup OrderGroup { get; }
Property Value
Type | Description |
---|---|
IOrderGroup |
ShipmentPrices
Gets the price matrix for shipments.
Declaration
public ShipmentPriceMatrix ShipmentPrices { get; }
Property Value
Type | Description |
---|---|
ShipmentPriceMatrix |
Methods
AddConditionalItems(ContentReference, IDictionary<String, Decimal>)
Adds all conditional SKU codes and their individual required quantities to the PromotionProcessorContext's ConditionItems.
Declaration
public void AddConditionalItems(ContentReference promotionLink, IDictionary<string, decimal> individualRequiredQuantities)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | promotionLink | The EPiServer.Core.ContentReference of the PromotionData having the |
System.Collections.Generic.IDictionary<System.String, System.Decimal> | individualRequiredQuantities | A collection of SKU codes and their required quantities to be purchased for |
AddConditionalItems(ContentReference, IEnumerable<String>, Decimal)
Adds all conditional SKU codes and the total required quantity to the PromotionProcessorContext's ConditionItems.
Declaration
public void AddConditionalItems(ContentReference promotionLink, IEnumerable<string> codes, decimal totalRequiredQuantity)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | promotionLink | The EPiServer.Core.ContentReference of the PromotionData having the |
System.Collections.Generic.IEnumerable<System.String> | codes | A collection of SKU codes making a promotion applicable for an OrderForm. |
System.Decimal | totalRequiredQuantity | The total quantity required to be purchased for |
AddEvaluatedSpendAmountPromotion(ContentReference)
Adds an spend amount promotion that has been evaluated to the promotion context.
Declaration
public void AddEvaluatedSpendAmountPromotion(ContentReference promotionLink)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | promotionLink | The EPiServer.Core.ContentReference of the PromotionData that is type of spend amount promotion. |
Clone()
Clones the promotion processor context object.
Declaration
public virtual PromotionProcessorContext Clone()
Returns
Type | Description |
---|---|
PromotionProcessorContext | The cloned context object. |
GetRemainingRedemptions(PromotionData)
Gets the remaining redemptions of a PromotionData
Declaration
public int GetRemainingRedemptions(PromotionData promotion)
Parameters
Type | Name | Description |
---|---|---|
PromotionData | promotion | The promotion. |
Returns
Type | Description |
---|---|
System.Int32 | The remaining redemptions, or System.Int32.MaxValue if the promotion has no redemption limit. |
UpdateDiscounts()
Update the discount information on the line items, and shipments, that were used to populate EntryPrices and ShipmentPrices.
Declaration
public virtual void UpdateDiscounts()