Class BaseTaxProcessor

  extended by com.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended by com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended by
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.

David Tobey

Field Summary
(package private) static org.apache.commons.logging.Log log
Constructor Summary
Method Summary
abstract  int processTax()
 java.util.Map processTax(java.util.Map parameters)
          Assists with processing of tax charges.
 void updateTaxableSubtotal()
          Computes and updates the taxable subtotal of a user's order.
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getProductIDs, getSettings, getUser, initialize, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setSettings, setUser, updateOrderTotals, updateOrderTotals, utils
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject

Field Detail


static org.apache.commons.logging.Log log
Constructor Detail


public BaseTaxProcessor()
Method Detail


public abstract int processTax()
                        throws java.lang.Exception


public java.util.Map processTax(java.util.Map parameters)
                         throws java.lang.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 - A Map containing any input parameters from the user related to how the tax should be charged.
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.


public void updateTaxableSubtotal()
                           throws java.lang.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.


Copyright © SoftSlate, LLC 2003–2005