Class EntryDiscountCalculation
This class is intended to be used internally by EPiServer. We do not support any backward compatibility on this.
Inherited Members
Namespace: EPiServer.Commerce.Marketing.Internal
Assembly: EPiServer.Business.Commerce.dll
Version: 14.26.0Syntax
public class EntryDiscountCalculation : PriceCalculationBase
Constructors
EntryDiscountCalculation()
Declaration
public EntryDiscountCalculation()
Methods
ApplyDiscount(IEnumerable<PriceEntry>, Decimal, Decimal)
Apply a money-off discount on the entries.
Declaration
public Decimal ApplyDiscount(IEnumerable<PriceEntry> entries, Decimal totalAmount, Decimal discountAmount)
Parameters
Type | Name | Description |
---|---|---|
System. |
entries | The entries to be discounted. |
System. |
totalAmount | The initial total cost of the entries. |
System. |
discountAmount | The amount to discount per single unit. |
Returns
Type | Description |
---|---|
System. |
The saved amount, 0 if no discount was applied. |
ApplyDiscountIndividually(IEnumerable<PriceEntry>, Decimal, Decimal)
Apply a percent-off discount on the entries. It takes the percentage discount for an individual unit and then it works like an amount-off discount.
Declaration
public Decimal ApplyDiscountIndividually(IEnumerable<PriceEntry> entries, Decimal totalAmount, Decimal percent)
Parameters
Type | Name | Description |
---|---|---|
System. |
entries | The entries to be discounted. |
System. |
totalAmount | The initial total cost of the entries. |
System. |
percent | The percentage for the discount. Note that this should be given in the 0 - 100 range, and not as a fractional value. |
Returns
Type | Description |
---|---|
System. |
The saved amount, 0 if no discount was applied. |
ApplyFixedPrice(IEnumerable<PriceEntry>, Decimal, Decimal)
Apply a fixed-price discount on the entries.
Declaration
public Decimal ApplyFixedPrice(IEnumerable<PriceEntry> entries, Decimal totalAmount, Decimal fixedPrice)
Parameters
Type | Name | Description |
---|---|---|
System. |
entries | The entries to get at the fixed price. |
System. |
totalAmount | The initial total cost of the entries. |
System. |
fixedPrice | The discounted total cost to apply to the entries. |
Returns
Type | Description |
---|---|
System. |
The saved amount, 0 if no discount was applied. This will happen if totalAmount is less than the fixedPrice. |
ApplyFreeItems(IEnumerable<PriceEntry>, Decimal)
Apply a "free item" type discount on the entries.
Declaration
public Decimal ApplyFreeItems(IEnumerable<PriceEntry> entries, Decimal totalAmount)
Parameters
Type | Name | Description |
---|---|---|
System. |
entries | The entries to receive as free. |
System. |
totalAmount | The initial total cost of the entries. |
Returns
Type | Description |
---|---|
System. |
The saved amount, 0 if discount was not applied. This will happen if all entries are already free. |
ApplyPercentage(IEnumerable<PriceEntry>, Decimal, Decimal)
Apply a percent-off discount on the entries.
Declaration
public Decimal ApplyPercentage(IEnumerable<PriceEntry> entries, Decimal totalAmount, Decimal percent)
Parameters
Type | Name | Description |
---|---|---|
System. |
entries | The entries to be discounted. |
System. |
totalAmount | The initial total cost of the entries. |
System. |
percent | The percentage for the discount. Note that this should be given in the 0 - 100 range, and not as a fractional value. |
Returns
Type | Description |
---|---|
System. |
The saved amount, 0 if no discount was applied. |