Class BaseTaxProcessor
java.lang.Object
com.softslate.commerce.businessobjects.core.BaseBusinessObject
com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
com.softslate.commerce.businessobjects.tax.BaseTaxProcessor
- All Implemented Interfaces:
BusinessObject
,BusinessProcessor
,TaxProcessor
- Direct Known Subclasses:
AvaTaxProcessor
,BasicTaxProcessor
Abstract class that provides methods useful for
TaxProcessor
implementations.- Author:
- David Tobey
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
isShippingTaxable
(Order order) Integrations need to know if shipping on an order is taxable or not.abstract int
processTax
(Map parameters) Assists with processing of tax charges.void
Computes and updates the taxable subtotal of a user's order.void
updateTaxableSubtotal
(Order order) Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getEventBus, getInjector, getProductIDs, getSettings, getUser, initialize, isProcessorClassActive, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPGet, sendHTTPPost, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, updateOrderTotals, 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
initialize
-
Field Details
-
log
static org.apache.commons.logging.Log log
-
-
Constructor Details
-
BaseTaxProcessor
public BaseTaxProcessor()
-
-
Method Details
-
processTax
- Throws:
Exception
-
processTax
Assists with processing of tax charges. Copies the incomingMap
of parameters to thisBaseTaxProcessor
instance and callsupdateTaxableSubtotal()
, followed byprocessTax()
, followed byupdateTotalsAndStatuses()
to update the order's totals. Finally, writes the new totals to the database usingOrderGatewayDAO.updateOrderAndDelivery(boolean, com.softslate.commerce.businessobjects.order.Order, com.softslate.commerce.businessobjects.order.OrderDelivery)
.- Specified by:
processTax
in interfaceTaxProcessor
- Parameters:
parameters
- AMap
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
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 firstOrderDelivery
are updated with the new taxable subtotal.- Throws:
Exception
-
updateTaxableSubtotal
- Throws:
Exception
-
isShippingTaxable
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 interfaceTaxProcessor
- Returns:
-