Class AvaTaxProcessor

All Implemented Interfaces:
BusinessObject, BusinessProcessor, AddressValidationProcessor, TaxProcessor

public class AvaTaxProcessor extends BaseTaxProcessor implements AddressValidationProcessor
Integrates with the AvaTax service. For technical reference: http://developer.avalara.com/ and http://developer.avalara.com/resources/api-sample-code
  • Field Details

    • log

      static org.apache.commons.logging.Log log
    • errorMessage

      private String errorMessage
  • Constructor Details

    • AvaTaxProcessor

      public AvaTaxProcessor()
  • Method Details

    • processTax

      public Map processTax(Map parameters) throws Exception
      Description copied from class: BaseTaxProcessor
      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
      Overrides:
      processTax in class BaseTaxProcessor
      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
    • processTax

      public int processTax() throws Exception
      Specified by:
      processTax in class BaseTaxProcessor
      Throws:
      Exception
    • shouldDoAddressValidationDuringTaxes

      protected boolean shouldDoAddressValidationDuringTaxes(Order order)
    • isCountrySetToVerifyAddresses

      protected boolean isCountrySetToVerifyAddresses(Order order)
    • shouldDoAddressValidationAfterAddressSubmitted

      protected boolean shouldDoAddressValidationAfterAddressSubmitted(Order order)
    • taxShouldBeZero

      public boolean taxShouldBeZero(Order order) throws Exception
      Throws:
      Exception
    • isCustomerTaxExempt

      protected boolean isCustomerTaxExempt(Order order)
    • taxShouldFallBackToBasicRates

      public boolean taxShouldFallBackToBasicRates(Order order)
    • isCountrySetToCalculateTax

      protected boolean isCountrySetToCalculateTax(Order order)
    • isStateSetToCalculateTax

      protected boolean isStateSetToCalculateTax(Order order)
    • doFallBack

      protected int doFallBack() throws Exception
      Throws:
      Exception
    • processAvaTax

      public int processAvaTax() throws Exception
      Throws:
      Exception
    • validateAddress

      public Map validateAddress(Map parameters) throws Exception
      Specified by:
      validateAddress in interface AddressValidationProcessor
      Throws:
      Exception
    • validateAddressDuringTaxes

      public int validateAddressDuringTaxes(Order order) throws Exception
      Throws:
      Exception
    • validateAddressReturningErrorsAndMessages

      public Map validateAddressReturningErrorsAndMessages(Order order) throws Exception
      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

      public String doAddressErrorMessage(com.avalara.avatax.services.address.ArrayOfMessage messages)
    • doGetTax

      public com.avalara.avatax.services.tax.GetTaxResult doGetTax() throws Exception
      Throws:
      Exception
    • doGetTax

      public com.avalara.avatax.services.tax.GetTaxResult doGetTax(Order order) throws Exception
      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

      public Date doDocDate(Order order)
    • 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

      public String doItemTaxCode(OrderItem oi)
    • totalOfTaxableGlobalDiscounts

      public double totalOfTaxableGlobalDiscounts(Order order)
    • lineForShipping

      public com.avalara.avatax.services.tax.Line lineForShipping(Order order, int count)
    • doErrorMessage

      public String doErrorMessage(com.avalara.avatax.services.tax.ArrayOfMessage messages)
    • doErrorName

      public String doErrorName(com.avalara.avatax.services.tax.ArrayOfMessage messages)
    • doGetTaxAndCommit

      public com.avalara.avatax.services.tax.GetTaxResult doGetTaxAndCommit() throws Exception
      Throws:
      Exception
    • doGetTaxAndCommit

      public com.avalara.avatax.services.tax.GetTaxResult doGetTaxAndCommit(Order order) throws Exception
      Throws:
      Exception
    • doCancelTax

      public com.avalara.avatax.services.tax.CancelTaxResult doCancelTax(Order order) throws Exception
      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

      public com.avalara.avatax.services.tax.IsAuthorizedResult doTestConnection() throws Exception
      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