London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Class DefaultReturnLineItemCalculator

NOTE: This is a pre-release API that is UNSTABLE and might not satisfy the compatibility requirements as denoted by its associated normal version.

The default return line item calculator.

Inheritance
System.Object
DefaultReturnLineItemCalculator
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Order.Calculator
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0
Syntax
public class DefaultReturnLineItemCalculator : IReturnLineItemCalculator

Constructors

DefaultReturnLineItemCalculator(ITaxCalculator)

Initialize a new instance of the DefaultReturnLineItemCalculator class.

Declaration
public DefaultReturnLineItemCalculator(ITaxCalculator taxCalculator)
Parameters
Type Name Description
ITaxCalculator taxCalculator

The tax calculator.

Methods

CalculateDiscountedPrice(IReturnLineItem, Currency)

Calculates the discounted price for an IReturnLineItem.

Declaration
protected virtual Money CalculateDiscountedPrice(IReturnLineItem returnLineItem, Currency currency)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item to calculate the extended price for.

Currency currency

The currency to be used in the calculations.

Returns
Type Description
Money

The discounted price.

CalculateExtendedPrice(IReturnLineItem, Currency)

Calculates the extended price for an IReturnLineItem.

Declaration
protected virtual Money CalculateExtendedPrice(IReturnLineItem returnLineItem, Currency currency)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item to calculate the extended price for.

Currency currency

The currency to be used in the calculations.

Returns
Type Description
Money

The rounded extended price.

CalculateSalesTax(IReturnLineItem, IMarket, Currency, IOrderAddress)

Calculates sales tax for the return line item.

Declaration
protected virtual Money CalculateSalesTax(IReturnLineItem returnLineItem, IMarket market, Currency currency, IOrderAddress shippingAddress)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item.

IMarket market

The market to be used in the calculation.

Currency currency

The currency to be used in the calculations.

IOrderAddress shippingAddress

The shipping address to be used in the calculations.

Returns
Type Description
Money

The sales tax for the return line item.

GetDiscountedPrice(IReturnLineItem, Currency)

Gets the discounted price for an IReturnLineItem.

Declaration
public Money GetDiscountedPrice(IReturnLineItem returnLineItem, Currency currency)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item.

Currency currency

The currency to be used in the calculations.

Returns
Type Description
Money

The discounted price of the return line item.

Examples
        public void GetDiscountedPrice(IReturnLineItem returnLineItem, Currency currency, IReturnLineItemCalculator returnLineItemCalculator)
{
var discountedPrice = returnLineItemCalculator.GetDiscountedPrice(returnLineItem, currency);
Debug.WriteLine("Discounted price for '{0}': {1}", returnLineItem.Code, discountedPrice);
}
Exceptions
Type Condition
System.Exception

Thrown when calculation fails.

GetExtendedPrice(IReturnLineItem, Currency)

Gets the extended price for an IReturnLineItem.

Declaration
public Money GetExtendedPrice(IReturnLineItem returnLineItem, Currency currency)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item.

Currency currency

The currency to be used in the calculations.

Returns
Type Description
Money

The rounded extended price of the return line item.

Examples
        public void GetExtendedPrice(IReturnLineItem returnLineItem, Currency currency, IReturnLineItemCalculator returnLineItemCalculator)
{
var extendedPrice = returnLineItemCalculator.GetExtendedPrice(returnLineItem, currency);
Debug.WriteLine("Extended price for '{0}': {1}", returnLineItem.Code, extendedPrice);
}
Exceptions
Type Condition
System.Exception

Thrown when calculation fails.

GetLineItemPrices(IReturnLineItem, Currency)

Gets the extended and discounted prices of an IReturnLineItem.

Declaration
public LineItemPrices GetLineItemPrices(IReturnLineItem returnLineItem, Currency currency)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item to calculate the extended price for.

Currency currency

The currency to be used in the calculations.

Returns
Type Description
LineItemPrices

The prices for the return line item.

Examples
        public void GetReturnLineItemPrices(IReturnLineItem returnLineItem, Currency currency, IReturnLineItemCalculator returnLineItemCalculator)
{
var lineItemdPrices = returnLineItemCalculator.GetLineItemPrices(returnLineItem, currency);
Debug.WriteLine("Extended price for '{0}': {1}", returnLineItem.Code, lineItemdPrices.ExtendedPrice);
Debug.WriteLine("Discounted price for '{0}': {1}", returnLineItem.Code, lineItemdPrices.DiscountedPrice);
}

GetSalesTax(IReturnLineItem, IMarket, Currency, IOrderAddress)

Gets sales tax for the return line item.

Declaration
public Money GetSalesTax(IReturnLineItem returnLineItem, IMarket market, Currency currency, IOrderAddress shippingAddress)
Parameters
Type Name Description
IReturnLineItem returnLineItem

The return line item.

IMarket market

The market to be used in the calculation.

Currency currency

The currency to be used in the calculations.

IOrderAddress shippingAddress

The shipping address to be used in the calculations.

Returns
Type Description
Money

The sales tax for the return line item.

Examples
        public void GetSalesTax(IReturnLineItem returnLineItem, IMarket market, Currency currency, IOrderAddress shippingAddress, IReturnLineItemCalculator returnLineItemCalculator)
{
var salesTax = returnLineItemCalculator.GetSalesTax(returnLineItem, market, currency, shippingAddress);
Debug.WriteLine("Sales tax for '{0}': {1}", returnLineItem.Code, salesTax);
}

ValidateDiscountedPrice(Money)

Validates the discounted price.

Declaration
protected virtual void ValidateDiscountedPrice(Money money)
Parameters
Type Name Description
Money money

The calculated value.

ValidateExtendedPrice(Money)

Validates the extended price.

Declaration
protected virtual void ValidateExtendedPrice(Money money)
Parameters
Type Name Description
Money money

The calculated value.

ValidateSalesTax(Money)

Validates the sales tax.

Declaration
protected virtual void ValidateSalesTax(Money money)
Parameters
Type Name Description
Money money

The calculated value.

Implements