com.softslate.commerce.businessobjects.tax
Class BaseTaxProcessor

java.lang.Object
  extended by com.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended by com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended by com.softslate.commerce.businessobjects.tax.BaseTaxProcessor
All Implemented Interfaces:
BusinessObject, BusinessProcessor, TaxProcessor
Direct Known Subclasses:
BasicTaxProcessor

public abstract class BaseTaxProcessor
extends BaseBusinessProcessor
implements TaxProcessor

Abstract class that provides methods useful for TaxProcessor implementations.

Author:
David Tobey

Field Summary
(package private) static org.apache.commons.logging.Log log
           
 
Constructor Summary
BaseTaxProcessor()
           
 
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.
 void updateTotalsAndStatuses()
          Updates the totals and statuses of a user's order with a new tax charge included.
 
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, 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
initialize
 

Field Detail

log

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

BaseTaxProcessor

public BaseTaxProcessor()
Method Detail

processTax

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

processTax

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:
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:
java.lang.Exception

updateTaxableSubtotal

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.

Throws:
java.lang.Exception

updateTotalsAndStatuses

public void updateTotalsAndStatuses()
                             throws java.lang.Exception
Updates the totals and statuses of a user's order with a new tax charge included. The user's Order and that order's first OrderDelivery are updated with new price totals and subtotals.

Throws:
java.lang.Exception


Copyright ? SoftSlate, LLC 2003?2005