Class PromotionFilterContext
Contains a collection of PromotionData that multiple filters can act on while leaving additional meta data in the context for later use.
Inheritance
Inherited Members
Namespace: EPiServer.Commerce.Marketing
Assembly: EPiServer.Business.Commerce.dll
Version: 12.17.2Syntax
public class PromotionFilterContext
Constructors
PromotionFilterContext(IEnumerable<PromotionData>, RequestFulfillmentStatus)
Initializes a new instance of the PromotionFilterContext class.
Declaration
public PromotionFilterContext(IEnumerable<PromotionData> promotions, RequestFulfillmentStatus requestedStatuses)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<PromotionData> | promotions | The promotions. |
RequestFulfillmentStatus | requestedStatuses | The statuses to generate RewardDescriptions for. |
Properties
ExcludedPromotionDescriptions
Contains RewardDescription instances that filters may add to describe promotions that are not included in IncludedPromotions, i.e. promotions that did not fulfill the filter's conditions to be kept for evaluation by the PromotionEngine.
Declaration
public IEnumerable<RewardDescription> ExcludedPromotionDescriptions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<RewardDescription> |
IncludedPromotions
Contains the included promotions, i.e. the promotions that have fulfilled the conditions of the filters that have processed the context and are kept for evaluation by the PromotionEngine.
Declaration
public IEnumerable<PromotionData> IncludedPromotions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PromotionData> |
RequestedStatuses
Gets the statuses to generate RewardDescriptions for.
Declaration
public RequestFulfillmentStatus RequestedStatuses { get; }
Property Value
Type | Description |
---|---|
RequestFulfillmentStatus |
Methods
AddCouponCode(Guid, String)
Adds a connection between a promotion and a coupon code to describe that the promotion was included (i.e. kept in IncludedPromotions by the filter) based on a supplied coupon code.
Declaration
public void AddCouponCode(Guid promotionGuid, string promotionCode)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | promotionGuid | The promotion identifier. |
System.String | promotionCode | The promotion code. |
AddVisitorGroup(ContentReference, Guid)
Adds a connection between a campaign and a visitor group to describe that the promotions of the campaign were included (i.e. kept in IncludedPromotions by the filter) based on the user's membership in the visitor group.
Declaration
public void AddVisitorGroup(ContentReference campaignLink, Guid visitorGroupId)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | campaignLink | The campaign link. |
System.Guid | visitorGroupId | The visitor group ID. |
ExcludePromotion(PromotionData, FulfillmentStatus, Boolean)
Excludes a promotion from IncludedPromotions and adds a an instance to ExcludedPromotionDescriptions describing why the promotion did not fulfill the filter's conditions to be kept for evaluation by the PromotionEngine.
Declaration
public void ExcludePromotion(PromotionData promotion, FulfillmentStatus reason, bool createDescription)
Parameters
Type | Name | Description |
---|---|---|
PromotionData | promotion | The promotion to exclude. |
FulfillmentStatus | reason | A reason for excluding the promotion. Used to add an instance to
ExcludedPromotionDescriptions with
Status set to
NotFulfilled masked together with
|
System.Boolean | createDescription |
|
GetCouponCode(Guid)
Gets the coupon code that was used to include a promotion (i.e. kept in IncludedPromotions by the filter), if the promotion was included based on a supplied coupon code.
Declaration
public string GetCouponCode(Guid promotionGuid)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | promotionGuid | The promotion identifier. |
Returns
Type | Description |
---|---|
System.String | The used coupon code, or |
GetVisitorGroup(ContentReference)
Gets the visitor group that the filter used to include the promotions of a campaign (i.e. keep the promotions in IncludedPromotions), if the promotions were included based on the user's membership in a visitor group
Declaration
public Guid? GetVisitorGroup(ContentReference campaignLink)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | campaignLink |
Returns
Type | Description |
---|---|
System.Nullable<System.Guid> | The id of the EPiServer.Personalization.VisitorGroups.VisitorGroup, or |