Class RewardApplicatorBase<TAffectedObject>
When implemented, modifies discounts on a ILineItem or a IShipment. It also modifies saved amount of the applying reward.
Inheritance
Inherited Members
Namespace: EPiServer.Commerce.Marketing
Assembly: EPiServer.Business.Commerce.dll
Version: 12.17.2Syntax
public abstract class RewardApplicatorBase<TAffectedObject> : RewardApplicatorBase where TAffectedObject : IAffectedObject
Type Parameters
Name | Description |
---|---|
TAffectedObject |
Constructors
RewardApplicatorBase()
Declaration
protected RewardApplicatorBase()
Methods
AddGiftItem(TAffectedObject, PromotionProcessorContext)
Adds the gift item to shipment of order.
Declaration
protected virtual decimal AddGiftItem(TAffectedObject item, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
TAffectedObject | item | The affected item containing the discount. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Returns
Type | Description |
---|---|
System.Decimal |
Apply(RewardDescription, RedemptionDescription, PromotionProcessorContext)
Applies a reward for each redemption to the EntryAmount or OrderAmount or ShipmentDiscount
Declaration
protected virtual void Apply(RewardDescription reward, RedemptionDescription redemption, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
RewardDescription | reward | Information about the discount. |
RedemptionDescription | redemption | The redemption of the discount. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Apply(RewardDescription, Int32, PromotionProcessorContext)
Applies a reward to the EntryAmount or OrderAmount or ShipmentDiscount.
Declaration
public override void Apply(RewardDescription reward, int remainingRedemptions, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
RewardDescription | reward | The reward description. |
System.Int32 | remainingRedemptions | The number of remaining redemptions. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Overrides
ApplyDiscount(TAffectedObject, Decimal, PromotionProcessorContext)
Applies an amount discount.
Declaration
protected abstract decimal ApplyDiscount(TAffectedObject item, decimal discountAmount, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
TAffectedObject | item | The affected item. |
System.Decimal | discountAmount | The discount amount. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Returns
Type | Description |
---|---|
System.Decimal | The discounted amount. |
Remarks
If the discount amount combined with any previously set discount exceeds the total price for the line item then the discount will be the remaining amount of the total priced reduced by the already existing discounts.
ApplyFixedPrice(TAffectedObject, Decimal, PromotionProcessorContext)
Applies a fixed price discount.
Declaration
protected virtual decimal ApplyFixedPrice(TAffectedObject item, decimal fixedPrice, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
TAffectedObject | item | The affected item containing the discount. |
System.Decimal | fixedPrice | The fixed price to use. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Returns
Type | Description |
---|---|
System.Decimal | The discounted amount. |
ApplyFreeItems(TAffectedObject, PromotionProcessorContext)
Applies a free item discount.
Declaration
protected virtual decimal ApplyFreeItems(TAffectedObject item, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
TAffectedObject | item | The affected item containing the discount. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Returns
Type | Description |
---|---|
System.Decimal | The discounted amount. |
ApplyNotSpecified(TAffectedObject, RewardDescription, PromotionProcessorContext)
Applies none specified discount.
Declaration
protected virtual decimal ApplyNotSpecified(TAffectedObject item, RewardDescription reward, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
TAffectedObject | item | The affected item containing the discount. |
RewardDescription | reward | The reward. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Returns
Type | Description |
---|---|
System.Decimal | The discounted amount. |
ApplyPercentage(TAffectedObject, Decimal, PromotionProcessorContext)
Applies a percentage discount.
Declaration
protected abstract decimal ApplyPercentage(TAffectedObject item, decimal percentage, PromotionProcessorContext processorContext)
Parameters
Type | Name | Description |
---|---|---|
TAffectedObject | item | The affected item containing the discount. |
System.Decimal | percentage | The percentage to use. |
PromotionProcessorContext | processorContext | The promotion processor context for the promotion applicator. |
Returns
Type | Description |
---|---|
System.Decimal | The discounted amount. |