Class BaseTaxProcessor

All Implemented Interfaces:
BusinessObject, BusinessProcessor, TaxProcessor
Direct Known Subclasses:
AvaTaxProcessor, BasicTaxProcessor

public abstract class BaseTaxProcessor extends BaseBusinessProcessor implements TaxProcessor
Abstract class that provides methods useful for TaxProcessor implementations.
Author:
David Tobey
  • Field Details

    • log

      static org.apache.commons.logging.Log log
  • Constructor Details

    • BaseTaxProcessor

      public BaseTaxProcessor()
  • Method Details

    • processTax

      public abstract int processTax() throws Exception
      Throws:
      Exception
    • processTax

      public Map processTax(Map parameters) throws Exception
      Assists with processing of tax charges. Copies the incoming Map of parameters to this BaseTaxProcessor instance and calls updateTaxableSubtotal(), followed by processTax(), followed by updateTotalsAndStatuses() to update the order's totals. Finally, writes the new totals to the database using OrderGatewayDAO.updateOrderAndDelivery(boolean, com.softslate.commerce.businessobjects.order.Order, com.softslate.commerce.businessobjects.order.OrderDelivery).
      Specified by:
      processTax in interface TaxProcessor
      Parameters:
      parameters - A Map containing any input parameters from the user related to how the tax should be charged.
      Returns:
      A Map containing a least one key named "resultCode", which contains a String parsable into an integer, representing the results of the processing. 0 for the resultCode indicates success, anything else indicates an error and that processing should stop.
      Throws:
      Exception
    • updateTaxableSubtotal

      public void updateTaxableSubtotal() throws Exception
      Computes and updates the taxable subtotal of a user's order. The taxable subtotal is determined by first looping through each of the cart items. The total of each item whose corresponding product is taxable is added to the subtotal. Next, the current order's discounts are looped over. The totals of discounts corresponding to order items that are taxable are subtracted from the taxable subtotal. Global discounts are also subtracted, if the "applyDiscountsToTaxableSubtotal" setting is set to true.

      The user's Order and that order's first OrderDelivery are updated with the new taxable subtotal.

      Throws:
      Exception
    • updateTaxableSubtotal

      public void updateTaxableSubtotal(Order order) throws Exception
      Throws:
      Exception
    • isShippingTaxable

      public boolean isShippingTaxable(Order order)
      Description copied from interface: TaxProcessor
      Integrations need to know if shipping on an order is taxable or not. This opens up BaseTaxProcessor.isStateWhereShippingIsTaxable so outside processes can use it, and individual tax processors can override it if necessary.
      Specified by:
      isShippingTaxable in interface TaxProcessor
      Returns: