TaxCalculationServiceglobal with sharing class TaxCalculationService This class provides the functionality required to connect to an external tax calculation service. EnumsVoidRequestReason
Methods
getSettingsglobal static TaxCalculationService.Settings getSettings() Gets the saved tax calculation settings. Return ValueA Settings DTO that contains the tax calculation settings excluding the password/license key. saveSettingsglobal static TaxCalculationService.SaveSettingsResponse saveSettings(TaxCalculationService.Settings settings) Saves the modified settings. If the password is empty, the existing password/license key is not overwritten. Input Parameters
isEnabledglobal static Boolean isEnabled() Determines whether external tax calculation is enabled. Return ValueTrue if the endpoint service is enabled. testConnectionglobal static TaxCalculationService.TestConnectionResponse testConnection(TaxCalculationService.Settings settings) Calls the external tax calculation service with the saved settings to validate values. This method bypasses the enabled flag. Return ValueA Response object that contains the state of the connection and errors that occurred. validateAddressglobal static TaxCalculationService.ValidateAddressResponse validateAddress(TaxCalculationService.Address address) Calls the external tax calculation service with the address to be validated. Return ValueA ValidateAddressResponse object that contains the validated address. calculateTaxglobal static TaxCalculationService.TaxResponse calculateTax(TaxCalculationService.TaxDocument document) Calls the external tax calculation service with the document for which tax is to be calculated. Return ValueA TaxResponse object that contains the tax values for the document. commitTaxglobal static TaxCalculationService.TaxResponse commitTax(TaxCalculationService.TaxDocument document) Calls the external tax calculation service with a document for which tax is to be calculated and committed. Return ValueA TaxResponse object that contains the tax values for the document. calculateReversalglobal static TaxCalculationService.ReversalResponse calculateReversal(TaxCalculationService.CreditDocument document) Calls the external tax calculation service with a credit document for which tax is to be calculated. The monetary values in the document are expected to be positive. The returned tax values will also be positive. Return ValueA ReversalResponse object that contains the tax values for the credit document. commitReversalglobal static TaxCalculationService.ReversalResponse commitReversal(TaxCalculationService.CreditDocument document) Calls the external tax calculation service with a credit document for which tax is to be calculated and committed. The monetary values in the document are expected to be positive. The returned tax values will also be positive. Return ValueA ReversalResponse object that contains the tax values for the credit document. voidTaxglobal static TaxCalculationService.VoidResponse voidTax(TaxCalculationService.VoidRequest request) Calls the external tax calculation service with a request to void a previously committed tax document. Return ValueA VoidResponse object. voidReversalglobal static TaxCalculationService.VoidResponse voidReversal(TaxCalculationService.VoidRequest request) Calls the external tax calculation service with a request to void a previously committed credit document. Return ValueA VoidResponse object. createWorkScopeglobal static Disposable createWorkScope() Creates a scope to facilitate grouping tax operations together. Scopes can be nested. Return ValueA Disposable object. 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. public void calculateTax(List<Document> documents) { fferpcore.Disposable workScope = fferpcore.TaxCalculationService.createWorkScope(); try { for(Document document : documents) { // The calculateTax method marshals the Document, calculates tax and unmarshals // the result. calculateTax(document); } } finally { // Use of try-finally ensures that the work scope is always disposed, // even if calculateTax results in an exception. workScope.dispose(); } } TaxCalculationService.Settingsglobal class Settings This class wraps the tax calculation settings in a Salesforce org. Properties
MethodsTaxCalculationService.Responseglobal virtual class Response Data returned from the external tax provider. Properties
TaxCalculationService.SaveSettingsResponseglobal class SaveSettingsResponse extends Response Data concerning an attempt to save settings. This class extends TaxCalculationService.Response Properties
Methods
SaveSettingsResponseglobal SaveSettingsResponse() SaveSettingsResponseglobal SaveSettingsResponse(TaxCalculationService.TestConnectionResponse response) TaxCalculationService.TestConnectionResponseglobal class TestConnectionResponse extends Response Data returned from the external tax provider following a connection test. This class extends TaxCalculationService.Response TaxCalculationService.ValidateAddressResponseglobal class ValidateAddressResponse extends Response Data returned from the external tax provider after validating an address. This class extends TaxCalculationService.Response Properties
TaxCalculationService.TaxResponseglobal virtual class TaxResponse extends Response Data returned from the external tax provider after calculating tax. This class extends TaxCalculationService.Response Properties
MethodsTaxResponseglobal TaxResponse() TaxCalculationService.TaxResponseLineglobal class TaxResponseLine Data concerning the calculated tax for a provided request line. Properties
TaxCalculationService.Addressglobal virtual class Address Data concerning an address. Properties
TaxCalculationService.ValidatedAddressglobal class ValidatedAddress extends Address Data concerning a validated address. This class extends TaxCalculationService.Address Properties
MethodsValidatedAddressglobal ValidatedAddress() TaxCalculationService.DocumentIdentityglobal virtual class DocumentIdentity Data that identifies a document. Properties
MethodsDocumentIdentityglobal DocumentIdentity(String companyCode, String documentCode) Construct a document identity with the given company code and document code. Input Parameters
TaxCalculationService.TaxDocumentglobal virtual class TaxDocument extends DocumentIdentity Document data provided to the external tax calculation service to calculate tax. This class extends TaxCalculationService.DocumentIdentity Properties
TaxCalculationService.TaxRequestLineglobal class TaxRequestLine Data concerning a tax line for calculation. Properties
TaxCalculationService.CreditDocumentglobal class CreditDocument extends TaxDocument Credit document data provided to the external tax calculation service to calculate tax. This class extends TaxCalculationService.TaxDocument Properties
TaxCalculationService.ReversalResponseglobal class ReversalResponse extends TaxResponse Data returned from the external tax provider following the tax calculation of a credit document. This class extends TaxCalculationService.TaxResponse MethodsReversalResponseglobal ReversalResponse() TaxCalculationService.VoidRequestglobal class VoidRequest Data provided to the external tax calculation service to void a document. Properties
Methods
VoidRequestglobal VoidRequest(TaxCalculationService.DocumentIdentity document, TaxCalculationService.VoidRequestReason reason) Construct a Void Request for the given Document with the given Reason. Input Parameters
VoidRequestglobal VoidRequest(String companyCode, String documentCode, TaxCalculationService.VoidRequestReason reason) Construct a Void Request for the given Document with the given Reason. Input Parameters
TaxCalculationService.VoidResponseglobal class VoidResponse extends Response Data returned from the external tax provider following the voiding of a document. This class extends TaxCalculationService.Response MethodsVoidResponseglobal VoidResponse() TaxCalculationService.TaxDetailglobal class TaxDetail Tax details by jurisdiction. Properties
|