org.mule.modules

mule-module-avalara

config

Namespacehttp://www.mulesoft.org/schema/mule/avalara
Schema Locationhttp://www.mulesoft.org/schema/mule/avalara/current/mule-avalara.xsd  (View Schema)
Schema Version2.0
Minimum Mule Version3.2

Module Overview

Avalara provides automated sales tax solutions to streamline cumbersome, error-prone tax compliance processes and reduce the risk of loss or penalty in case of an audit. Their automated solutions automatically perform address validation, jurisdiction research and rate calculation and allow you to manage even the most complicated tax issues, such as situs, nexus, tax tiers, tax holidays, exemptions, certificate management and product taxability rules.

Summary

Configuration
<avalara:config>
Configure an instance of this module
Message Processors
<avalara:adjust-tax>
Adjust Tax processor.
<avalara:cancel-tax>
Cancel tax, indicating the document that should be canceled and the reason for the operation.
<avalara:commit-tax>
Commit Tax processor
<avalara:fetch-batch-file>
Batch Fetch processor.
<avalara:get-tax>
Get Tax processor.
<avalara:get-tax-history>
Get Tax History processor
<avalara:is-batch-finished>
Has the Batch Processing finished

Fetches a Batch result

<avalara:ping>
Ping Avalara to test connectivity and version of the service.
<avalara:ping-with-credentials>
Ping Avalara to test connectivity and version of the service for a specific user.
<avalara:post-tax>
Post Tax processor
<avalara:save-batch>
Batch Save processor.
<avalara:validate-address>
Validate Address processor.

Configuration

To use the this module within a flow the namespace to the module must be included. The resulting flow will look similar to the following:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:avalara="http://www.mulesoft.org/schema/mule/avalara"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/avalara
               http://www.mulesoft.org/schema/mule/avalara/current/mule-avalara.xsd">

      <!-- here goes your flows and configuration elements -->

</mule>

This module is configured using the config element. This element must be placed outside of your flows and at the root of your Mule application. You can create as many configurations as you deem necessary as long as each carries its own name.

Each message processor, message source or transformer carries a config-ref attribute that allows the invoker to specify which configuration to use.

Attributes
TypeNameDefault ValueDescriptionJava TypeMIME TypeEncoding
xs:string name Optional. Give a name to this configuration so it can be later referenced.
xs:string addressServiceEndpoint https://development.avalara.net/Address/AddressSvc.asmx Optional. Address Webservice endpoint
xs:string batchServiceEndpoint https://development.avalara.net/Batch/BatchSvc.asmx Optional. Batch Webservice endpoint
xs:string taxServiceEndpoint https://development.avalara.net/Tax/TaxSvc.asmx Optional. Tax Webservice endpoint

Connection Pool

This connector offers automatic connection management via the use of a connection pool. The pool will act a storage mechanism for all the connections that are in-use by the user of this connector.

Prior to execution of a processor, the connector will attempt to lookup an already established connection and if one doesn't exists it will create one. That lookup mechanism is done in the connection pool via the use of connection variables declared as keys.

The user of the connector can configure the pool by adding a connection-pooling-profile to the connector configuration like this:

    <avalara:connection-pooling-profile maxActive="10" maxIdle="10"
                             exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="120" minEvictionMillis="60000" evictionCheckIntervalMillis="30000"/>

The following is a list of connection attributes, each connection attribute can be configured at the config element level or they can also be added to each processor. If they are used at the processor level they get the benefit of full expression resolution.

Connection Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
account Registered Avalara account String */* UTF-8
avalaraClient Target client to which make the call String */* UTF-8
license The matching license for the account String */* UTF-8

Reconnection Strategies

Reconnection Strategies specify how a connector behaves when its connection fails. You can control how Mule attempts to reconnect by specifying a number of criteria:

With a reconnection strategy, you can better control the behavior of a failed connection, by configuring it, for example, to re-attempt the connection only once every 15 minutes, and to give up after 30 attempts. You can also send an automatic notification to your IT administrator whenever this reconnection strategy goes into effect. You can even define a strategy that attempts to reconnect only during business hours. Such a setting can prove useful if your server is frequently shut down for nightly maintenance.

Configuration

A reconnection strategy that allows the user to configure how many times a reconnection should be attempted and how long to wait between attempts.

    <avalara:config>
         <reconnect count="5" frequency="1000"/>
    </avalara:config>
Reconnect Attributes
NameDefault ValueDescription
frequency 2000 Optional. How often (in ms) to reconnect
count 2 Optional. How many reconnection attempts to make

For more information about reconnection strategies in Mule, or even how to write your own custom reconnection strategy please check this section.

Message Processors

<avalara:adjust-tax>

Adjust Tax processor.

The Get Tax operation calculates tax for one or more invoiced items and displays details describing the calculation of tax for each line item.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
adjustmentReason The reason for this tax adjustment. int */*
adjustmentDescription A description of a tax adjustment. String */* UTF-8
companyCode Client application company reference code String */* UTF-8
docType The document type specifies the category of the document and affects how the document is treated after a tax calculation; see AvalaraDocumentType for more information about the specific document types. AvalaraDocumentType */*
docCode Optional. The internal reference code used by the client application. String */* UTF-8
docDate Date of invoice, purchase order, etc. XMLGregorianCalendar */*
salespersonCode Optional. The client application salesperson reference code. String */* UTF-8
customerCode Client application customer reference code String */* UTF-8
customerUsageType Optional. Client application customer or usage type. CustomerUsageType determines the exempt status of the transaction based on the exemption tax rules for the jurisdictions involved. CustomerUsageType may also be set at the line item level.

The standard values for the CustomerUsageType (A-L).
A Federal Government
B State/Local Govt.
C Tribal Government
D Foreign Diplomat
E Charitable Organization
F Religious/Education
G Resale
H Agricultural Production
I Industrial Prod/Mfg.
J Direct Pay Permit
K Direct Mail
L - Other

String */* UTF-8
discount The discount amount to apply to the document. The string represents a BigDecimal. String */* UTF-8
purchaseOrderNo Optional. Purchase order identifier. PurchaseOrderNo is required for single use exemption certificates to match the order and invoice with the certificate. String */* UTF-8
exemptionNo Optional. Exemption number used for this transaction String */* UTF-8
originCode Code that refers one of the address of the baseAddress collection. It has to be the same code of one of the address's addressCode. It represents the origin address. String */* UTF-8
destinationCode Code that refers one of the address of the baseAddress collection. It has to be the same code of one of the address's addressCode. It represents the destination address. String */* UTF-8
detailLevel Specifies the level of tax detail to return DetailLevelType */*
referenceCode Optional. For returns (see AvalaraDocumentType), refers to the AdjustTaxRequest of the original invoice. String */* UTF-8
locationCode Optional. Location Code value. It is Also referred to as a Store Location, Outlet Id, or Outlet code is a number assigned by the State which identifies a Store location. Some state returns require taxes are broken out separately for Store Locations. String */* UTF-8
commit false Optional. Commit flag. If Commit is set to true, tax for the transaction is saved, posted and committed as tax document. boolean */*
batchCode Optional. The batchCode value. String */* UTF-8
currencyCode Optional. It is 3 character ISO 4217 currency code. String */* UTF-8
serviceMode AUTOMATIC Optional. This is only supported by AvaLocal servers. It provides the ability to controls whether tax is calculated locally or remotely when using an AvaLocal server. The default is Automatic which calculates locally unless remote is necessary for non-local addresses. ServiceModeType */*
paymentDate The date on which payment was made. XMLGregorianCalendar */*
exchangeRate The exchange rate value. The string represents a BigDecimal String */* UTF-8
exchangeRateEffDate The exchange rate effective date value. XMLGregorianCalendar */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Child Elements
NameDefault ValueDescriptionJava Type
<avalara:base-addresses> Collection of physical addresses that will be referred to as the destination or origination of 1 or more invoice line entries List<Map<String, Object>>
<avalara:lines> Collection of invoice lines requiring tax calculation List<Map<String, Object>>
<avalara:tax-override> Optional. Indicates to apply tax override to the document. Map<String, Object>
Returns
Return Type Description
AdjustTaxResult The AdjustTaxResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:cancel-tax>

Cancel tax, indicating the document that should be canceled and the reason for the operation.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
docId Optional. The original document's type, such as Sales Invoice or Purchase Invoice. String */* UTF-8
companyCode Client application company reference code. If docId is specified, this is not needed. String */* UTF-8
docType The document type specifies the category of the document and affects how the document is treated after a tax calculation; see AvalaraDocumentType for more information about the specific document types. AvalaraDocumentType */*
docCode Optional. The internal reference code used by the client application. String */* UTF-8
cancelCode A code indicating the reason the document is getting canceled. CancelCodeType */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
CancelTaxResult The CancelTaxResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:commit-tax>

Commit Tax processor

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
docId Optional. The original document's type, such as Sales Invoice or Purchase Invoice. String */* UTF-8
companyCode Client application company reference code. If docId is specified, this is not needed. String */* UTF-8
docType The document type specifies the category of the document and affects how the document is treated after a tax calculation; see AvalaraDocumentType for more information about the specific document types. AvalaraDocumentType */*
docCode Optional. The internal reference code used by the client application. String */* UTF-8
newDocCode Optional. The new document code value. String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
CommitTaxResult The CommitTaxRequest
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:fetch-batch-file>

Batch Fetch processor.

Fetches a Batch result

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
batchId The numerical identifier of the BatchFile. String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
Map<String, BatchFileFetchResult> The Map
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:get-tax>

Get Tax processor.

The Get Tax operation calculates tax for one or more invoiced items and displays details describing the calculation of tax for each line item.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
companyCode Client application company reference code String */* UTF-8
docType The document type specifies the category of the document and affects how the document is treated after a tax calculation; see AvalaraDocumentType for more information about the specific document types. AvalaraDocumentType */*
docCode Optional. The internal reference code used by the client application. String */* UTF-8
docDate Date of invoice, purchase order, etc. XMLGregorianCalendar */*
salespersonCode Optional. The client application salesperson reference code. String */* UTF-8
customerCode Client application customer reference code String */* UTF-8
customerUsageType Optional. Client application customer or usage type. CustomerUsageType determines the exempt status of the transaction based on the exemption tax rules for the jurisdictions involved. CustomerUsageType may also be set at the line item level.

The standard values for the CustomerUsageType (A-L).
A Federal Government
B State/Local Govt.
C Tribal Government
D Foreign Diplomat
E Charitable Organization
F Religious/Education
G Resale
H Agricultural Production
I Industrial Prod/Mfg.
J Direct Pay Permit
K Direct Mail
L - Other

String */* UTF-8
discount The discount amount to apply to the document. The string represents a BigDecimal. String */* UTF-8
purchaseOrderNo Optional. Purchase order identifier. PurchaseOrderNo is required for single use exemption certificates to match the order and invoice with the certificate. String */* UTF-8
exemptionNo Optional. Exemption number used for this transaction String */* UTF-8
originCode Code that refers one of the address of the baseAddress collection. It has to be the same code of one of the address's addressCode. It represents the origin address. String */* UTF-8
destinationCode Code that refers one of the address of the baseAddress collection. It has to be the same code of one of the address's addressCode. It represents the destination address. String */* UTF-8
detailLevel Specifies the level of tax detail to return DetailLevelType */*
referenceCode Optional. For returns (see AvalaraDocumentType), refers to the getDocCode() of the original invoice. String */* UTF-8
locationCode Optional. Location Code value. It is Also referred to as a Store Location, Outlet Id, or Outlet code is a number assigned by the State which identifies a Store location. Some state returns require taxes are broken out separately for Store Locations. String */* UTF-8
commit false Optional. Commit flag. If Commit is set to true, tax for the transaction is saved, posted and committed as tax document. boolean */*
batchCode Optional. The batchCode value. String */* UTF-8
currencyCode Optional. It is 3 character ISO 4217 currency code. String */* UTF-8
serviceMode AUTOMATIC Optional. This is only supported by AvaLocal servers. It provides the ability to controls whether tax is calculated locally or remotely when using an AvaLocal server. The default is Automatic which calculates locally unless remote is necessary for non-local addresses. ServiceModeType */*
paymentDate The date on which payment was made. XMLGregorianCalendar */*
exchangeRate The exchange rate value. The string represents a BigDecimal String */* UTF-8
exchangeRateEffDate The exchange rate effective date value. XMLGregorianCalendar */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Child Elements
NameDefault ValueDescriptionJava Type
<avalara:base-addresses> Collection of physical addresses that will be referred to as the destination or origination of 1 or more invoice line entries List<Map<String, Object>>
<avalara:lines> Collection of invoice lines requiring tax calculation List<Map<String, Object>>
<avalara:tax-override> Optional. Indicates to apply tax override to the document. Map<String, Object>
Returns
Return Type Description
GetTaxResult The GetTaxResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:get-tax-history>

Get Tax History processor

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
docId Optional. The original document's type, such as Sales Invoice or Purchase Invoice. String */* UTF-8
companyCode Client application company reference code. If docId is specified, this is not needed. String */* UTF-8
docType The document type specifies the category of the document and affects how the document is treated after a tax calculation; see AvalaraDocumentType for more information about the specific document types. AvalaraDocumentType */*
docCode Optional. The internal reference code used by the client application. String */* UTF-8
detailLevel Specifies the level of detail to return. See DetailLevelType. DetailLevelType */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
GetTaxHistoryResult The GetTaxHistoryResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:is-batch-finished>

Has the Batch Processing finished

Fetches a Batch result

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
batchId The numerical identifier of the BatchFile. String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
boolean a boolean representing if the Batch finished or not
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:ping>

Ping Avalara to test connectivity and version of the service.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
message Ping Optional. Ping Message String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
PingResult The PingResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:ping-with-credentials>

Ping Avalara to test connectivity and version of the service for a specific user. It is needed to specify the credentials for the user since this operation does not use the global connector configuration.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
pingAccount Avalara Account Number String */* UTF-8
pingAvalaraClient Avalara Client String */* UTF-8
pingLicense Avalara License String */* UTF-8
message PingWithCredentials Optional. Ping Message String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
PingResult The PingResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:post-tax>

Post Tax processor

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
docId Optional. The original document's type, such as Sales Invoice or Purchase Invoice. String */* UTF-8
companyCode Client application company reference code. If docId is specified, this is not needed. String */* UTF-8
docType The document type specifies the category of the document and affects how the document is treated after a tax calculation; see AvalaraDocumentType for more information about the specific document types. AvalaraDocumentType */*
docCode Optional. The internal reference code used by the client application. String */* UTF-8
docDate The date on the invoice, purchase order, etc XMLGregorianCalendar */*
totalAmount The total amount (not including tax) for the document. This is used for verification and reconciliation. This should be the TotalAmount returned by GetTaxResult when tax was calculated for this document; otherwise the web service will return an error. The string represents a BigDecimal String */* UTF-8
totalTax The total tax for the document. This is used for verification and reconciliation. This should be the TotalTax returned by GetTaxResult when tax was calculated for this document; otherwise the web service will return an error. The string represents a BigDecimal String */* UTF-8
commit false Optional. The commit value. This has been defaulted to false. If this has been set to true AvaTax will commit the document on this call. Seller's system who wants to Post and Commit the document on one call should use this flag. boolean */*
newDocCode Optional. The new document code value. String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
PostTaxResult The PostTaxResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:save-batch>

Batch Save processor.

Saves a Batch. Note that you should pass-in your console credentials for this method, instead of the API ones

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
batchType The kind of records to be imported. BatchType */*
companyId The id of the company. (Need to be retrived from address bar in Avalara after hitting the Organization Tab) int */*
content The content of this import, usually a csv file. String */* UTF-8
batchName Optional. The name of the batch. String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
BatchSaveResult The BatchSaveResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

<avalara:validate-address>

Validate Address processor.

This operation validates the supplied address, returning canonical form and additional delivery details if successfully validated.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
line1 Address line 1 String */* UTF-8
line2 Optional. Address line 2 String */* UTF-8
line3 Optional. Address line 3 String */* UTF-8
city Optional. City name. Required, when PostalCode is not specified. String */* UTF-8
region Optional. State or region name. Requirad, when PostalCode is not specified. String */* UTF-8
country Optional. Country code String */* UTF-8
postalCode Optional. Postal or ZIP code. Required, when City and Region are not specified String */* UTF-8
addressCode Optional. The address code. String */* UTF-8
taxRegionId The tax region id. Integer */*
latitude Optional. Latitude. String */* UTF-8
longitude Optional. Longitude. String */* UTF-8
textCase DEFAULT Optional. The casing to apply to the validated address(es). TextCaseType */*
coordinates false Optional. True, if you want in the result a not empty latitud and longitude. boolean */*
taxability false Optional. True, if you want the valid taxRegionId in the result. boolean */*
date Date. XMLGregorianCalendar */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
account Optional. Registered Avalara account String */* UTF-8
avalaraClient Optional. Target client to which make the call String */* UTF-8
license Optional. The matching license for the account String */* UTF-8
Returns
Return Type Description
ValidateResult The ValidateResult
Exception Payloads
Payload ClassDescription
AvalaraRuntimeException

Message Sources

Transformers