Class DefaultOrderFormCalculator
Order form calculator.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Commerce.Order.Calculator
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0Syntax
public class DefaultOrderFormCalculator : IOrderFormCalculator
Constructors
DefaultOrderFormCalculator(IShippingCalculator, ILineItemCalculator, ITaxCalculator)
Initializes a new instance of the DefaultOrderFormCalculator class.
Declaration
public DefaultOrderFormCalculator(IShippingCalculator shippingCalculator, ILineItemCalculator lineItemCalculator, ITaxCalculator taxCalculator)
Parameters
| Type | Name | Description |
|---|---|---|
| IShippingCalculator | shippingCalculator | The shipping calculator. |
| ILineItemCalculator | lineItemCalculator | The line item calculator. |
| ITaxCalculator | taxCalculator | The tax calculator. |
Methods
CalculateHandlingTotal(IOrderForm, Currency)
Calculates the handling total for the order form. It's intended be overridden
Declaration
protected virtual Money CalculateHandlingTotal(IOrderForm orderForm, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form |
| Currency | currency | The currency to be used in the calculations |
Returns
| Type | Description |
|---|---|
| Money | returns 0 |
CalculateSubtotal(IOrderForm, Currency)
Calculates the total of extended prices for all line items in the order form.
Declaration
protected virtual Money CalculateSubtotal(IOrderForm orderForm, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form |
| Currency | currency | The currency to be used in the calculation |
Returns
| Type | Description |
|---|---|
| Money | The sub total for the order form. |
Remarks
Gets the result by looping over all line items on all shipments and calling LineItemCalculator.GetExtendedPrice
Examples
CalculateTotal(IOrderForm, IMarket, Currency)
Calculates the total for the order form
Declaration
protected virtual Money CalculateTotal(IOrderForm orderForm, IMarket market, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form |
| IMarket | market | The market to be used in the calculation. |
| Currency | currency | The currency to be used in the calculation |
Returns
| Type | Description |
|---|---|
| Money | The total for the order form. |
Remarks
Formula: GetTotals + ShippingCalculator.GetShippingCost + TaxCalculator.GetTaxTotal
Examples
GetDiscountTotal(IOrderForm, Currency)
Gets the order form discount total.
Declaration
public Money GetDiscountTotal(IOrderForm orderForm, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form. |
| Currency | currency | The currency. |
Returns
| Type | Description |
|---|---|
| Money | The order form discount total. |
GetHandlingTotal(IOrderForm, Currency)
Calculates the handling total for the order form.
Declaration
public Money GetHandlingTotal(IOrderForm orderForm, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form |
| Currency | currency | The currency to be used in the calculations |
Returns
| Type | Description |
|---|---|
| Money | returns 0 |
Exceptions
| Type | Condition |
|---|---|
| System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
GetOrderDiscountTotal(IOrderForm, Currency)
Gets the order form discount price
Declaration
public Money GetOrderDiscountTotal(IOrderForm orderForm, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form. |
| Currency | currency | The currency. |
Returns
| Type | Description |
|---|---|
| Money | The order form discount price. |
GetSubTotal(IOrderForm, Currency)
Calculates the total of extended prices for all line items in the order form.
Declaration
public Money GetSubTotal(IOrderForm orderForm, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form |
| Currency | currency | The currency to be used in the calculation |
Returns
| Type | Description |
|---|---|
| Money | The sub total for the order form. |
Remarks
Gets the result by looping over all line items on all shipments and calling LineItemCalculator.GetExtendedPrice
Examples
Exceptions
| Type | Condition |
|---|---|
| System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
GetTotal(IOrderForm, IMarket, Currency)
Calculates the total for the order form
Declaration
public Money GetTotal(IOrderForm orderForm, IMarket market, Currency currency)
Parameters
| Type | Name | Description |
|---|---|---|
| IOrderForm | orderForm | The order form |
| IMarket | market | The market to be used in the calculation. |
| Currency | currency | The currency to be used in the calculation |
Returns
| Type | Description |
|---|---|
| Money | The total for the order form. |
Remarks
Formula: GetTotals + ShippingCalculator.GetShippingCost + TaxCalculator.GetTaxTotal
Examples
Exceptions
| Type | Condition |
|---|---|
| System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
ValidateHandlingTotal(Money)
Validates the handling total
Declaration
protected virtual void ValidateHandlingTotal(Money money)
Parameters
| Type | Name | Description |
|---|---|---|
| Money | money | The calculated value |
Exceptions
| Type | Condition |
|---|---|
| System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
ValidateSubtotal(Money)
Validates the sub total
Declaration
protected virtual void ValidateSubtotal(Money money)
Parameters
| Type | Name | Description |
|---|---|---|
| Money | money | The calculated value |
Exceptions
| Type | Condition |
|---|---|
| System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
ValidateTotal(Money)
Validates the total
Declaration
protected virtual void ValidateTotal(Money money)
Parameters
| Type | Name | Description |
|---|---|---|
| Money | money | The calculated value |
Exceptions
| Type | Condition |
|---|---|
| System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |