Class DefaultOrderGroupCalculator
The default order group calculator.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Commerce.Order.Calculator
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0Syntax
public class DefaultOrderGroupCalculator : IOrderGroupCalculator
Constructors
DefaultOrderGroupCalculator(IOrderFormCalculator)
Declaration
[Obsolete("This constructor is no longer used. Use the one with IMarketService instead. Will remain at least May 2019.")]
public DefaultOrderGroupCalculator(IOrderFormCalculator orderFormCalculator)
Parameters
Type | Name | Description |
---|---|---|
IOrderFormCalculator | orderFormCalculator |
DefaultOrderGroupCalculator(IOrderFormCalculator, IReturnOrderFormCalculator, IMarketService)
Creates a new instance of DefaultOrderGroupCalculator.
Declaration
public DefaultOrderGroupCalculator(IOrderFormCalculator orderFormCalculator, IReturnOrderFormCalculator returnOrderFormCalculator, IMarketService marketService)
Parameters
Type | Name | Description |
---|---|---|
IOrderFormCalculator | orderFormCalculator | The order form calculator. |
IReturnOrderFormCalculator | returnOrderFormCalculator | The return order form calculator. |
IMarketService | marketService | The market service. |
Methods
CalculateHandlingTotal(IOrderGroup)
Calculates the handling total for the order.
Declaration
protected virtual Money CalculateHandlingTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The handling total of the order group. |
CalculateOrderDiscountTotal(IOrderGroup)
Calculates the order discount price.
Declaration
protected virtual Money CalculateOrderDiscountTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The order discount price. |
CalculateShippingSubTotal(IOrderGroup)
Calculates shipping subtotal of the orderGroup
.
Declaration
protected virtual Money CalculateShippingSubTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The shipping subtotal of the order group with full precision. |
CalculateSubTotal(IOrderGroup)
Calculates the subtotal for the order group.
Declaration
protected virtual Money CalculateSubTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The subtotal of the order group with full precision. |
CalculateTaxTotal(IOrderGroup)
Calculates tax total of the orderGroup
.
Declaration
protected virtual Money CalculateTaxTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The tax total of the order group with full precision. |
CalculateTotal(IOrderGroup)
Calculates the total for the order.
Declaration
protected virtual Money CalculateTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The total for the order group with full precision. |
GetHandlingTotal(IOrderGroup)
Gets the handling total for the order group.
Declaration
public Money GetHandlingTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The handling total of the order group. |
Examples
public void GetHandlingTotal(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var handlingTotal = orderGroupCalculator.GetHandlingTotal(orderGroup);
Debug.WriteLine("Handling total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, handlingTotal);
}
Exceptions
Type | Condition |
---|---|
System.ComponentModel.DataAnnotations.ValidationException | Thrown when calculation fails. |
GetOrderDiscountTotal(IOrderGroup)
Gets the order discount price.
Declaration
public Money GetOrderDiscountTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | The order discount price. |
Examples
public void GetOrderDiscountTotal(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var orderDiscountTotal = orderGroupCalculator.GetOrderDiscountTotal(orderGroup);
Debug.WriteLine("Order discount total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, orderDiscountTotal);
}
GetOrderDiscountTotal(IOrderGroup, Currency)
Gets the order discount price.
Declaration
[Obsolete("This method is no longer used, use the overload without Currency instead. Will remain at least until May 2019.")]
public Money GetOrderDiscountTotal(IOrderGroup orderGroup, Currency currency)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Currency | currency | The currency. |
Returns
Type | Description |
---|---|
Money | The order discount price. |
GetOrderGroupTotals(IOrderGroup)
Gets the order group totals.
Declaration
public OrderGroupTotals GetOrderGroupTotals(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
OrderGroupTotals | An order group totals. |
Examples
public void GetOrderGroupTotals(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var orderGroupTotals = orderGroupCalculator.GetOrderGroupTotals(orderGroup);
Debug.WriteLine("Handling total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, orderGroupTotals.HandlingTotal);
Debug.WriteLine("Shipping subtotal for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, orderGroupTotals.ShippingTotal);
Debug.WriteLine("Tax total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, orderGroupTotals.TaxTotal);
Debug.WriteLine("Subtotal for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, orderGroupTotals.SubTotal);
Debug.WriteLine("Total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, orderGroupTotals.Total);
}
GetShippingSubTotal(IOrderGroup)
Gets the shipping subtotal of the orderGroup
.
Declaration
public Money GetShippingSubTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | Rounded value for the shipping subtotal of the order group. |
Examples
public void GetShippingSubTotal(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var shippingSubTotal = orderGroupCalculator.GetShippingSubTotal(orderGroup);
Debug.WriteLine("Shipping subtotal for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, shippingSubTotal);
}
Exceptions
Type | Condition |
---|---|
System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
GetSubTotal(IOrderGroup)
Gets the subtotal of all order forms in the order.
Declaration
public Money GetSubTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | Rounded value for the total of all order forms in the order. |
Examples
public void GetSubTotal(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var subTotal = orderGroupCalculator.GetSubTotal(orderGroup);
Debug.WriteLine("Subtotal for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, subTotal);
}
Exceptions
Type | Condition |
---|---|
System.ComponentModel.DataAnnotations.ValidationException | If validation fails. |
GetTaxTotal(IOrderGroup)
Gets the tax total of the orderGroup
.
Declaration
public Money GetTaxTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | Rounded value for the tax toal of the order group. |
Examples
public void GetTaxTotal(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var taxTotal = orderGroupCalculator.GetTaxTotal(orderGroup);
Debug.WriteLine("Tax total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, taxTotal);
}
GetTotal(IOrderGroup)
Gets the total for the order.
Declaration
public Money GetTotal(IOrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
IOrderGroup | orderGroup | The order group. |
Returns
Type | Description |
---|---|
Money | Rounded valur for the total of the order group. |
Examples
public void GetTotal(IOrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator)
{
var total = orderGroupCalculator.GetTotal(orderGroup);
Debug.WriteLine("Total for order group '{0}': {1}", orderGroup.OrderLink.OrderGroupId, total);
}
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. |
ValidateShippingSubTotal(Money)
Validates the shipping subtotal.
Declaration
protected virtual void ValidateShippingSubTotal(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 subtotal.
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. |
ValidateTaxTotal(Money)
Validates the tax total.
Declaration
protected virtual void ValidateTaxTotal(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. |