Loading...

Last updated: Apr 16 2018

Area: Episerver Commerce Applies to versions: 12 and higher
Other versions:

Return order form calculator

The ReturnOrderFormCalculator calculates the total, subtotal, handling total, shipping subtotal, order discount total, discount total, and tax total for a return order form.

  • Total. Calculates the total for a return order form.
    public void GetTotal(IReturnOrderForm returnOrderForm, IMarket market, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var total = returnOrderFormCalculator.GetTotal(returnOrderForm, market, currency);
        Debug.WriteLine("Total for return order form '{0}': {1}", returnOrderForm.OrderFormId, total);
    }
  • SubTotal. Calculates the total of all shipments in a return order form.
    public void GetSubTotal(IReturnOrderForm returnOrderForm, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var subTotal = returnOrderFormCalculator.GetSubTotal(returnOrderForm, currency);
        Debug.WriteLine("Subtotal for return order form '{0}': {1}", returnOrderForm.OrderFormId, subTotal);
    }
  • HandlingTotal. Calculates the handling total for a return order form.
    public void GetHandlingTotal(IReturnOrderForm returnOrderForm, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var handlingTotal = returnOrderFormCalculator.GetHandlingTotal(returnOrderForm, currency);
        Debug.WriteLine("Handling total for return order form '{0}': {1}", returnOrderForm.OrderFormId, handlingTotal);
    }
  • ShippingSubtotal. Calculates the shipping subtotal for a return order form.
    public void GetShippingSubTotal(IReturnOrderForm returnOrderForm, IMarket market, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var shippingSubTotal = returnOrderFormCalculator.GetShippingSubTotal(returnOrderForm, market, currency);
        Debug.WriteLine("Shipping subtotal for return order form '{0}': {1}", returnOrderForm.OrderFormId, shippingSubTotal);
    }
  • OrderDiscountTotal. Calculates a return order form discount amount. It is the total of order-level discounts of all line items in all shipments in a return order form.
    public void GetOrderDiscountTotal(IReturnOrderForm returnOrderForm, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var orderDiscountTotal = returnOrderFormCalculator.GetOrderDiscountTotal(returnOrderForm, currency);
        Debug.WriteLine("Order discount total for return order form '{0}': {1}", returnOrderForm.OrderFormId, orderDiscountTotal);
    }
  • DiscountTotal. Calculates a return order form discount total. It is the total of order-level discount amount and line item discount amount of all line items in all shipments and shipment discount amount of all shipments in a return order form.
    public void GetDiscountTotal(IReturnOrderForm returnOrderForm, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var discountTotal = returnOrderFormCalculator.GetDiscountTotal(returnOrderForm, currency);
        Debug.WriteLine("Discount total for return order form '{0}': {1}", returnOrderForm.OrderFormId, discountTotal);
    }
  • TaxTotal. Calculates the tax total for a return order form.
    public void GetReturnTaxTotal(IReturnOrderForm returnOrderForm, IMarket market, Currency currency, IReturnOrderFormCalculator returnOrderFormCalculator)
    {
        var returnTaxTotal = returnOrderFormCalculator.GetReturnTaxTotal(returnOrderForm, market, currency);
        Debug.WriteLine("Tax total for return order form '{0}': {1}", returnOrderForm.OrderFormId, returnTaxTotal);
    }

Changing the default calculation

By inheriting from the default implementation of the interface, DefaultReturnOrderFormCalculator, you can override the calculations. Just override one or several of the methods in DefaultReturnOrderFormCalculator.

Change the default validation

The default implementation validates that the totals are not negative after the calculation. To change the behavior, override the ValidateTotal, ValidateSubtotal, ValidateHandlingTotal, ValidateShippingSubTotal, or ValidateTaxTotal method, depending on which validation you should override.


Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/