TaxCalculationServiceglobal with sharing class TaxCalculationService
This class provides the functionality required to connect to an external tax calculation service. EnumsAddressTextCaseThe letter case to use for the validated address.
DocumentType
DetailLevelThe level of detail to be returned from the tax service.
VoidRequestReason
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. commitTaxglobal static TaxCalculationService.TaxResponse commitTax(TaxCalculationService.CommitRequest request) Calls the external tax calculation service with a request to commit a draft document. 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. commitReversalglobal static TaxCalculationService.ReversalResponse commitReversal(TaxCalculationService.CommitRequest request) Calls the external tax calculation service with a request to commit a draft return document. The returned tax values will be positive. Return ValueA ReversalResponse object that contains the tax values for the credit document. uncommitTaxglobal static TaxCalculationService.UncommitResponse uncommitTax(TaxCalculationService.UncommitRequest request) Calls the external tax calculation service with a request to uncommit a document. Return ValueAn UncommitResponse object. uncommitReversalglobal static TaxCalculationService.UncommitResponse uncommitReversal(TaxCalculationService.UncommitRequest request) Calls the external tax calculation service with a request to uncommit a return document. Return ValueAn UncommitResponse object. 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. unvoidTaxglobal static TaxCalculationService.UnvoidResponse unvoidTax(TaxCalculationService.UnvoidRequest request) Calls the external tax calculation service with a request to unvoid a previously voided document. Return ValueAn UnvoidResponse object. unvoidReversalglobal static TaxCalculationService.UnvoidResponse unvoidReversal(TaxCalculationService.UnvoidRequest request) Calls the external tax calculation service with a request to unvoid a previously voided credit document. Return ValueAn UnvoidResponse object. verifyTaxglobal static TaxCalculationService.VerifyResponse verifyTax(TaxCalculationService.VerifyRequest request) Calls the external tax calculation service with a request to verify a previously created uncommitted document. Return ValueA VerifyResponse object. verifyReversalglobal static TaxCalculationService.VerifyResponse verifyReversal(TaxCalculationService.VerifyRequest request) Calls the external tax calculation service with a request to verify a previously created uncommitted return document. The monetary values in the request are expected to be positive. Return ValueA VerifyResponse 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 inherited sharing class Settings This class wraps the tax calculation settings in a Salesforce org. Properties
MethodsTaxCalculationService.AdvancedMessageglobal inherited sharing class AdvancedMessage Message data with enhanced information. Properties
TaxCalculationService.Responseglobal inherited sharing virtual class Response Data returned from the external tax provider. Properties
TaxCalculationService.SaveSettingsResponseglobal inherited sharing 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 inherited sharing class TestConnectionResponse extends Response Data returned from the external tax provider following a connection test. This class extends TaxCalculationService.Response TaxCalculationService.ValidateAddressResponseglobal inherited sharing class ValidateAddressResponse extends Response Data returned from the external tax provider after validating an address. This class extends TaxCalculationService.Response Properties
TaxCalculationService.TaxResponseglobal inherited sharing 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 inherited sharing class TaxResponseLine Data concerning the calculated tax for a provided request line. Properties
TaxCalculationService.Addressglobal inherited sharing virtual class Address Data concerning an address. Properties
TaxCalculationService.ValidatedAddressglobal inherited sharing class ValidatedAddress extends Address Data concerning a validated address. This class extends TaxCalculationService.Address Properties
MethodsValidatedAddressglobal ValidatedAddress() TaxCalculationService.DocumentIdentityglobal inherited sharing 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 inherited sharing virtual class TaxDocument extends DocumentIdentity Document data provided to the external tax calculation service to calculate tax. This class extends TaxCalculationService.DocumentIdentity Properties
TaxCalculationService.CommitRequestglobal inherited sharing class CommitRequest Data provided to the external tax calculation service to commit an existing document. Properties
Methods
CommitRequestglobal CommitRequest() CommitRequestglobal CommitRequest(TaxCalculationService.DocumentIdentity document, TaxCalculationService.DetailLevel detailsToInclude) Construct a commit request for an existing document, specifying the level of detail to include in the tax response. Input Parameters
TaxCalculationService.TaxRequestLineglobal inherited sharing class TaxRequestLine Data concerning a tax line for calculation. Properties
TaxCalculationService.CreditDocumentglobal inherited sharing 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 inherited sharing 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.UncommitRequestglobal inherited sharing class UncommitRequest Data provided to the external tax calculation service to uncommit an existing document. Properties
MethodsUncommitRequestglobal UncommitRequest() UncommitRequestglobal UncommitRequest(TaxCalculationService.DocumentIdentity document) Construct an uncommit request for an existing document. Input Parameters
TaxCalculationService.UncommitResponseglobal inherited sharing class UncommitResponse extends Response Data returned from the external tax provider following the uncommit of a document. This class extends TaxCalculationService.Response Properties
MethodsUncommitResponseglobal UncommitResponse() TaxCalculationService.VoidRequestglobal inherited sharing 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 inherited sharing 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 inherited sharing class TaxDetail Tax details by jurisdiction. Properties
TaxCalculationService.UnvoidRequestglobal inherited sharing class UnvoidRequest Data provided to the external tax calculation service to unvoid a void document. Properties
MethodsUnvoidRequestglobal UnvoidRequest() UnvoidRequestglobal UnvoidRequest(TaxCalculationService.DocumentIdentity document) Construct an unvoid request for an existing void document. Input Parameters
TaxCalculationService.UnvoidResponseglobal inherited sharing class UnvoidResponse extends Response Data returned from the external tax provider following the unvoiding of a document. This class extends TaxCalculationService.Response Properties
MethodsUnvoidResponseglobal UnvoidResponse() TaxCalculationService.VerifyRequestglobal inherited sharing class VerifyRequest Data provided to the external tax calculation service to verify a document. Properties
MethodsVerifyRequestglobal VerifyRequest() TaxCalculationService.VerifyResponseglobal inherited sharing class VerifyResponse extends Response Data returned from the external tax provider following the verifying of a document. This class extends TaxCalculationService.Response Properties
MethodsVerifyResponseglobal VerifyResponse() |