Last updated: Apr 16 2018

Area: Episerver Commerce Applies to versions: 12 and higher

Return line item calculator

The ReturnLineItemCalculator calculates a return line item's extended price, discounted price, and sales tax.
  • ExtendedPrice. Calculates the price including order-level discount amount (spread over all return line items in the shipment) and any return line item discount amounts.
    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);
  • DiscountedPrice. Only calculates the price with the "line item discount amount," that is, the discount for a specific return line item.
    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);
  • SalesTax. Calculates sales tax for a return line item.
    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);

Change the default calculation

By inheriting from the default implementation of the interface, DefaultReturnLineItemCalculator, you override the calculations. Just override one or more methods in DefaultReturnLineItemCalculator.

Changing the default validation

The default implementation validates that the return values are not negative after the calculation. To change the behavior, override the validation methods, depending on which validation you should override.