Class AvaTaxProcessor
java.lang.Object
com.softslate.commerce.businessobjects.core.BaseBusinessObject
com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
com.softslate.commerce.businessobjects.tax.BaseTaxProcessor
com.softslate.commerce.businessobjects.tax.AvaTaxProcessor
- All Implemented Interfaces:
BusinessObject
,BusinessProcessor
,AddressValidationProcessor
,TaxProcessor
Integrates with the AvaTax service. For technical reference:
http://developer.avalara.com/ and
http://developer.avalara.com/resources/api-sample-code
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
(package private) static org.apache.commons.logging.Log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondoAddressErrorMessage
(com.avalara.avatax.services.address.ArrayOfMessage messages) com.avalara.avatax.services.tax.CancelTaxResult
doCancelTax
(Order order) com.avalara.avatax.services.tax.CancelTaxResult
doCancelTax
(Order order, int taxRequestNumber) com.avalara.avatax.services.tax.CancelTaxResult
doCancelTax
(Order order, String docType) com.avalara.avatax.services.tax.CancelTaxResult
doCancelTax
(Order order, String docType, int taxRequestNumber) doErrorMessage
(com.avalara.avatax.services.tax.ArrayOfMessage messages) doErrorName
(com.avalara.avatax.services.tax.ArrayOfMessage messages) protected int
com.avalara.avatax.services.tax.GetTaxResult
doGetTax()
com.avalara.avatax.services.tax.GetTaxResult
com.avalara.avatax.services.tax.GetTaxResult
com.avalara.avatax.services.tax.GetTaxResult
com.avalara.avatax.services.tax.GetTaxResult
com.avalara.avatax.services.tax.GetTaxResult
doGetTaxAndCommit
(Order order) com.avalara.avatax.services.tax.GetTaxHistoryResult
doGetTaxHistory
(Order order) com.avalara.avatax.services.tax.GetTaxHistoryResult
doGetTaxHistory
(Order order, int taxRequestNumber) doItemAmount
(OrderItem oi, double orderSubtotal, double totalOfTaxableGlobalDiscounts) com.avalara.avatax.services.tax.PostTaxResult
com.avalara.avatax.services.tax.PostTaxResult
doPostTaxAndCommit
(Order order) com.avalara.avatax.services.tax.PostTaxResult
doPostTaxAndCommit
(Order order, int taxRequestNumber) com.avalara.avatax.services.tax.PostTaxResult
doPostTaxNoCommit
(Order order, String docType) com.avalara.avatax.services.tax.IsAuthorizedResult
com.avalara.avatax.services.address.AddressSvcSoap
com.avalara.avatax.services.tax.TaxSvcSoap
protected boolean
isCountrySetToCalculateTax
(Order order) protected boolean
protected boolean
isCustomerTaxExempt
(Order order) protected boolean
isStateSetToCalculateTax
(Order order) com.avalara.avatax.services.tax.Line
lineForOrderItem
(OrderItem oi, int count, double orderSubtotal, double totalOfTaxableGlobalDiscounts) com.avalara.avatax.services.tax.Line
lineForShipping
(Order order, int count) int
int
processTax
(Map parameters) Assists with processing of tax charges.protected boolean
protected boolean
boolean
taxShouldBeZero
(Order order) boolean
double
validateAddress
(Map parameters) int
validateAddressDuringTaxes
(Order order) Methods inherited from class com.softslate.commerce.businessobjects.tax.BaseTaxProcessor
isShippingTaxable, updateTaxableSubtotal, updateTaxableSubtotal
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
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessProcessor
getAppComponents, getAppSettings, getBusinessObjectFactory, getDaoFactory, getEventBus, getInjector, getSettings, getUser, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, utils
-
Field Details
-
log
static org.apache.commons.logging.Log log -
errorMessage
-
-
Constructor Details
-
AvaTaxProcessor
public AvaTaxProcessor()
-
-
Method Details
-
processTax
Description copied from class:BaseTaxProcessor
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
- Overrides:
processTax
in classBaseTaxProcessor
- 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
-
processTax
- Specified by:
processTax
in classBaseTaxProcessor
- Throws:
Exception
-
shouldDoAddressValidationDuringTaxes
-
isCountrySetToVerifyAddresses
-
shouldDoAddressValidationAfterAddressSubmitted
-
taxShouldBeZero
- Throws:
Exception
-
isCustomerTaxExempt
-
taxShouldFallBackToBasicRates
-
isCountrySetToCalculateTax
-
isStateSetToCalculateTax
-
doFallBack
- Throws:
Exception
-
processAvaTax
- Throws:
Exception
-
validateAddress
- Specified by:
validateAddress
in interfaceAddressValidationProcessor
- Throws:
Exception
-
validateAddressDuringTaxes
- Throws:
Exception
-
validateAddressReturningErrorsAndMessages
- Throws:
Exception
-
getAddressSvc
public com.avalara.avatax.services.address.AddressSvcSoap getAddressSvc() throws javax.xml.rpc.ServiceException, javax.xml.soap.SOAPException, MalformedURLException- Throws:
javax.xml.rpc.ServiceException
javax.xml.soap.SOAPException
MalformedURLException
-
doAddressErrorMessage
-
doGetTax
- Throws:
Exception
-
doGetTax
- Throws:
Exception
-
doGetTax
public com.avalara.avatax.services.tax.GetTaxResult doGetTax(Order order, String docType, boolean commitTax) throws Exception - Throws:
Exception
-
doGetTax
public com.avalara.avatax.services.tax.GetTaxResult doGetTax(Order order, String docType, boolean commitTax, int taxRequestNumber) throws Exception - Throws:
Exception
-
getTaxSvc
public com.avalara.avatax.services.tax.TaxSvcSoap getTaxSvc() throws javax.xml.rpc.ServiceException, javax.xml.soap.SOAPException, MalformedURLException, IOException- Throws:
javax.xml.rpc.ServiceException
javax.xml.soap.SOAPException
MalformedURLException
IOException
-
doDocDate
-
lineForOrderItem
public com.avalara.avatax.services.tax.Line lineForOrderItem(OrderItem oi, int count, double orderSubtotal, double totalOfTaxableGlobalDiscounts) -
doItemAmount
public BigDecimal doItemAmount(OrderItem oi, double orderSubtotal, double totalOfTaxableGlobalDiscounts) -
doItemTaxCode
-
totalOfTaxableGlobalDiscounts
-
lineForShipping
-
doErrorMessage
-
doErrorName
-
doGetTaxAndCommit
- Throws:
Exception
-
doGetTaxAndCommit
- Throws:
Exception
-
doCancelTax
- Throws:
Exception
-
doCancelTax
public com.avalara.avatax.services.tax.CancelTaxResult doCancelTax(Order order, int taxRequestNumber) throws Exception - Throws:
Exception
-
doCancelTax
public com.avalara.avatax.services.tax.CancelTaxResult doCancelTax(Order order, String docType) throws Exception - Throws:
Exception
-
doCancelTax
public com.avalara.avatax.services.tax.CancelTaxResult doCancelTax(Order order, String docType, int taxRequestNumber) throws Exception - Throws:
Exception
-
doPostTaxNoCommit
public com.avalara.avatax.services.tax.PostTaxResult doPostTaxNoCommit(Order order, String docType) throws Exception - Throws:
Exception
-
doPostTaxAndCommit
public com.avalara.avatax.services.tax.PostTaxResult doPostTaxAndCommit(Order order) throws Exception - Throws:
Exception
-
doPostTaxAndCommit
public com.avalara.avatax.services.tax.PostTaxResult doPostTaxAndCommit(Order order, int taxRequestNumber) throws Exception - Throws:
Exception
-
doPostTax
public com.avalara.avatax.services.tax.PostTaxResult doPostTax(Order order, String docType, boolean commitTax, int taxRequestNumber) throws Exception - Throws:
Exception
-
doTestConnection
- Throws:
Exception
-
doGetTaxHistory
public com.avalara.avatax.services.tax.GetTaxHistoryResult doGetTaxHistory(Order order) throws Exception - Throws:
Exception
-
doGetTaxHistory
public com.avalara.avatax.services.tax.GetTaxHistoryResult doGetTaxHistory(Order order, int taxRequestNumber) throws Exception - Throws:
Exception
-