ffbc.AvalaraTaxServiceglobal with sharing class AvalaraTaxService This class provides the functionality required to connect to Avalara. Salesforce determines the maximum number of callouts that you can make to an external service such as Avalara. See the Salesforce documentation for more information. EnumsMessageSeverityAn enum representing the severities of messages returned by Avalara.
Methods
getSettingsglobal static ffbc.AvalaraTaxService.Settings getSettings() Retrieves the Billing Central tax calculation settings for the org. Return ValueThe wrapper containing the settings. saveSettingsglobal static void saveSettings(ffbc.AvalaraTaxService.Settings settings) Saves settings. Input Parameters
Exceptions Thrown
getTaxglobal static List<ffbc.AvalaraTaxService.TaxResponse> getTax(List<ffbc.AvalaraTaxService.TaxDocument> documents) Sends a request to Avalara to calculate tax for the documents provided and returns the response. To calculate tax, the connection details on the Tax Calculation Settings tab must be valid. Input Parameters
Exceptions Thrown
Return ValueThe response to the tax calculation request for each document. Responses are provided in the same order in which the documents were supplied. validateDocumentsglobal static List<ffbc.AvalaraTaxService.DocumentValidationError> validateDocuments(Set<Id> billingDocumentIds) Validates that a document can be taxed. Input Parameters
Return ValueA list of validation errors. If this list is empty, the billing documents are valid. calculateglobal static List<ffbc.AvalaraTaxService.TaxResponse> calculate(Set<Id> billingDocumentIds) Sends a request to calculate tax for the given documents to Avalara, provided that no errors are encountered, then sets the tax rates and values on the document line items according to the response. If the process encounters an error, it stops and throws an exception. To calculate tax, the connection details on the Tax Calculation Settings tab must be valid. If Use Mappings Component for External Tax is enabled in BC Tax Calculation Settings, the configuration in the related FDN Mappings component is used for external tax calculation. Input Parameters
Exceptions Thrown
Return ValueThe response to the tax calculation request for each document. calculateglobal static List<ffbc.AvalaraTaxService.TaxResponse> calculate(ffbc.AvalaraTaxService.TaxRequest request) Sends a request to calculate tax for the given documents to Avalara, then sets the tax rates and values on the document line items according to the response. Input Parameters
Exceptions Thrown
Return ValueThe response to the tax calculation request for each document. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. /** * Example of using calculate() method of AvalaraTaxService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents for which tax will be calculated with Avalara, identified by ID. Set<Id> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.AvalaraTaxService.TaxRequest request = New ffbc.AvalaraTaxService.TaxRequest(); request.BillingDocumentIds = setOfBillingDocumentIds; request.ThrowExceptionForInvalidBillingDocument = false; List<ffbc.AvalaraTaxService.TaxResponse> responses = ffbc.AvalaraTaxService.calculate(request); calculateAsyncglobal static ffbc.AvalaraTaxService.TaxAsyncResponse calculateAsync(Set<Id> billingDocumentIds) Sends requests to calculate tax for the given documents to Avalara using a background process. As each response is received from Avalara, sets the tax rates and values on the corresponding billing document line items according to the response. Input Parameters
Return ValueA response containing the background process ID and the background process job ID. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. /** * Example of using calculateAsync() method of AvalaraTaxService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents for which tax will be calculated with Avalara, identified by ID. Set<Id> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.AvalaraTaxService.TaxAsyncResponse response = ffbc.AvalaraTaxService.calculateAsync(setOfBillingDocumentIds); commitTaxglobal static List<ffbc.AvalaraTaxService.TaxResponse> commitTax(ffbc.AvalaraTaxService.TaxRequest request) Sends a request to calculate and commit tax for the given documents to Avalara, then sets the tax rates and values on the document line items according to the response. Input Parameters
Exceptions Thrown
Return ValueThe response of the tax commit request for each document. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. /** * Example of using commitTax() method of AvalaraTaxService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents for which tax will be calculated and committed with Avalara, identified by ID. Set<Id> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.AvalaraTaxService.TaxRequest request = New ffbc.AvalaraTaxService.TaxRequest(); request.BillingDocumentIds = setOfBillingDocumentIds; request.ThrowExceptionForInvalidBillingDocument = false; List<ffbc.AvalaraTaxService.TaxResponse> responses = ffbc.AvalaraTaxService.commitTax(request); commitTaxAsyncglobal static ffbc.AvalaraTaxService.TaxAsyncResponse commitTaxAsync(Set<Id> billingDocumentIds) Sends requests to commit tax for the given documents to Avalara using a background process. As each response is received from Avalara, sets the tax rates and values on the corresponding billing document line items according to the response. Input Parameters
Return ValueA response containing the background process ID and the background process job ID. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. /** * Example of using commitTaxAsync() method of AvalaraTaxService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents for which tax will be committed with Avalara, identified by ID. Set<Id> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.AvalaraTaxService.TaxAsyncResponse response = ffbc.AvalaraTaxService.commitTaxAsync(setOfBillingDocumentIds); voidTaxglobal static List<ffbc.AvalaraTaxService.TaxResponse> voidTax(ffbc.AvalaraTaxService.TaxRequest request) Sends a request to void tax for the given documents to Avalara. Input Parameters
Exceptions Thrown
Return ValueThe response of the tax void request for each document. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. /** * Example of using voidTax() method of AvalaraTaxService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents for which tax will be voided in Avalara, identified by ID. Set<Id> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.AvalaraTaxService.TaxRequest request = New ffbc.AvalaraTaxService.TaxRequest(); request.BillingDocumentIds = setOfBillingDocumentIds; request.ThrowExceptionForInvalidBillingDocument = false; List<ffbc.AvalaraTaxService.TaxResponse> responses = ffbc.AvalaraTaxService.voidTax(request); voidTaxAsyncglobal static ffbc.AvalaraTaxService.TaxAsyncResponse voidTaxAsync(Set<Id> billingDocumentIds) Sends requests to void tax for the given documents to Avalara using a background process. Input Parameters
Return ValueA response containing the background process ID and the background process job ID. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. /** * Example of using voidTaxAsync() method of AvalaraTaxService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents for which tax will be voided in Avalara, identified by ID. Set<Id> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.AvalaraTaxService.TaxAsyncResponse response = ffbc.AvalaraTaxService.voidTaxAsync(setOfBillingDocumentIds); ffbc.AvalaraTaxService.DocumentValidationErrorglobal with sharing class DocumentValidationError This class wraps an error identified when validating a billing document. Properties
ffbc.AvalaraTaxService.Messageglobal with sharing class Message This class wraps a message associated with a response to an external tax calculation request. This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change. Properties
ffbc.AvalaraTaxService.Settingsglobal with sharing class Settings This class wraps the tax calculation settings for an organization. Properties
Methodsffbc.AvalaraTaxService.TaxDocumentglobal with sharing class TaxDocument An object representing a document for which tax can be calculated using Avalara. Properties
Methodsffbc.AvalaraTaxService.TaxDocumentLineItemglobal with sharing class TaxDocumentLineItem An object representing a line item of a document for which tax can be calculated using Avalara. Properties
Methodsffbc.AvalaraTaxService.TaxRequestglobal with sharing class TaxRequest This class provides the information required to calculate tax with Avalara for the billing documents. Properties
Methodsffbc.AvalaraTaxService.TaxResponseglobal with sharing class TaxResponse This class wraps a response to a tax calculation request. Properties
MethodsTaxResponseglobal TaxResponse() Creates a new tax response. You will not normally need to create an instance of this class. The constructor is global to make it easier for you to write unit tests for code that handles these responses. ffbc.AvalaraTaxService.TaxAsyncResponseglobal with sharing class TaxAsyncResponse extends Response This class wraps a response to an async tax calculation request. This class extends ffbc.Response Properties
ffbc.AvalaraTaxService.TaxResponseLineglobal with sharing class TaxResponseLine This class wraps a line of a response to a tax calculation request. This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change. Properties
ffbc.AvalaraTaxService.TaxResponseDetailglobal with sharing class TaxResponseDetail Tax breakdown details by jurisdiction, provided by Avalara. Properties
Methods |