fferpcore.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 fferpcore.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 fferpcore.TaxCalculationService.SaveSettingsResponse saveSettings(fferpcore.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 fferpcore.TaxCalculationService.TestConnectionResponse testConnection(fferpcore.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 fferpcore.TaxCalculationService.ValidateAddressResponse validateAddress(fferpcore.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 fferpcore.TaxCalculationService.TaxResponse calculateTax(fferpcore.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 fferpcore.TaxCalculationService.TaxResponse commitTax(fferpcore.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 fferpcore.TaxCalculationService.TaxResponse commitTax(fferpcore.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 fferpcore.TaxCalculationService.ReversalResponse calculateReversal(fferpcore.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 fferpcore.TaxCalculationService.ReversalResponse commitReversal(fferpcore.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 fferpcore.TaxCalculationService.ReversalResponse commitReversal(fferpcore.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 fferpcore.TaxCalculationService.UncommitResponse uncommitTax(fferpcore.TaxCalculationService.UncommitRequest request) Calls the external tax calculation service with a request to uncommit a document. Return ValueAn UncommitResponse object. uncommitReversalglobal static fferpcore.TaxCalculationService.UncommitResponse uncommitReversal(fferpcore.TaxCalculationService.UncommitRequest request) Calls the external tax calculation service with a request to uncommit a return document. Return ValueAn UncommitResponse object. voidTaxglobal static fferpcore.TaxCalculationService.VoidResponse voidTax(fferpcore.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 fferpcore.TaxCalculationService.VoidResponse voidReversal(fferpcore.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 fferpcore.TaxCalculationService.UnvoidResponse unvoidTax(fferpcore.TaxCalculationService.UnvoidRequest request) Calls the external tax calculation service with a request to unvoid a previously voided document. Return ValueAn UnvoidResponse object. unvoidReversalglobal static fferpcore.TaxCalculationService.UnvoidResponse unvoidReversal(fferpcore.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 fferpcore.TaxCalculationService.VerifyResponse verifyTax(fferpcore.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 fferpcore.TaxCalculationService.VerifyResponse verifyReversal(fferpcore.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 fferpcore.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(); } } fferpcore.TaxCalculationService.Settingsglobal class Settings This class wraps the tax calculation settings in a Salesforce org. Properties
Methodsfferpcore.TaxCalculationService.AdvancedMessageglobal class AdvancedMessage fferpcore.Message data with enhanced information. Properties
fferpcore.TaxCalculationService.Responseglobal virtual class Response Data returned from the external tax provider. Properties
fferpcore.TaxCalculationService.SaveSettingsResponseglobal class SaveSettingsResponse extends Response Data concerning an attempt to save settings. This class extends fferpcore.TaxCalculationService.Response Properties
Methods
SaveSettingsResponseglobal SaveSettingsResponse() SaveSettingsResponseglobal SaveSettingsResponse(fferpcore.TaxCalculationService.TestConnectionResponse response) fferpcore.TaxCalculationService.TestConnectionResponseglobal class TestConnectionResponse extends Response Data returned from the external tax provider following a connection test. This class extends fferpcore.TaxCalculationService.Response fferpcore.TaxCalculationService.ValidateAddressResponseglobal class ValidateAddressResponse extends Response Data returned from the external tax provider after validating an address. This class extends fferpcore.TaxCalculationService.Response Properties
fferpcore.TaxCalculationService.TaxResponseglobal virtual class TaxResponse extends Response Data returned from the external tax provider after calculating tax. This class extends fferpcore.TaxCalculationService.Response Properties
MethodsTaxResponseglobal TaxResponse() fferpcore.TaxCalculationService.TaxResponseLineglobal class TaxResponseLine Data concerning the calculated tax for a provided request line. Properties
fferpcore.TaxCalculationService.Addressglobal virtual class Address Data concerning an address. Properties
fferpcore.TaxCalculationService.ValidatedAddressglobal class ValidatedAddress extends Address Data concerning a validated address. This class extends fferpcore.TaxCalculationService.Address Properties
MethodsValidatedAddressglobal ValidatedAddress() fferpcore.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
fferpcore.TaxCalculationService.TaxDocumentglobal virtual class TaxDocument extends DocumentIdentity Document data provided to the external tax calculation service to calculate tax. This class extends fferpcore.TaxCalculationService.DocumentIdentity Properties
fferpcore.TaxCalculationService.CommitRequestglobal class CommitRequest Data provided to the external tax calculation service to commit an existing document. Properties
Methods
CommitRequestglobal CommitRequest() CommitRequestglobal CommitRequest(fferpcore.TaxCalculationService.DocumentIdentity document, fferpcore.TaxCalculationService.DetailLevel detailsToInclude) Construct a commit request for an existing document, specifying the level of detail to include in the tax response. Input Parameters
fferpcore.TaxCalculationService.TaxRequestLineglobal class TaxRequestLine Data concerning a tax line for calculation. Properties
fferpcore.TaxCalculationService.CreditDocumentglobal class CreditDocument extends TaxDocument Credit document data provided to the external tax calculation service to calculate tax. This class extends fferpcore.TaxCalculationService.TaxDocument Properties
fferpcore.TaxCalculationService.ReversalResponseglobal class ReversalResponse extends TaxResponse Data returned from the external tax provider following the tax calculation of a credit document. This class extends fferpcore.TaxCalculationService.TaxResponse MethodsReversalResponseglobal ReversalResponse() fferpcore.TaxCalculationService.UncommitRequestglobal class UncommitRequest Data provided to the external tax calculation service to uncommit an existing document. Properties
Methods
UncommitRequestglobal UncommitRequest() UncommitRequestglobal UncommitRequest(fferpcore.TaxCalculationService.DocumentIdentity document) Construct an uncommit request for an existing document. Input Parameters
fferpcore.TaxCalculationService.UncommitResponseglobal class UncommitResponse extends Response Data returned from the external tax provider following the uncommit of a document. This class extends fferpcore.TaxCalculationService.Response Properties
MethodsUncommitResponseglobal UncommitResponse() fferpcore.TaxCalculationService.VoidRequestglobal class VoidRequest Data provided to the external tax calculation service to void a document. Properties
Methods
VoidRequestglobal VoidRequest(fferpcore.TaxCalculationService.DocumentIdentity document, fferpcore.TaxCalculationService.VoidRequestReason reason) Construct a Void Request for the given Document with the given Reason. Input Parameters
VoidRequestglobal VoidRequest(String companyCode, String documentCode, fferpcore.TaxCalculationService.VoidRequestReason reason) Construct a Void Request for the given Document with the given Reason. Input Parameters
fferpcore.TaxCalculationService.VoidResponseglobal class VoidResponse extends Response Data returned from the external tax provider following the voiding of a document. This class extends fferpcore.TaxCalculationService.Response MethodsVoidResponseglobal VoidResponse() fferpcore.TaxCalculationService.TaxDetailglobal class TaxDetail Tax details by jurisdiction. Properties
fferpcore.TaxCalculationService.UnvoidRequestglobal class UnvoidRequest Data provided to the external tax calculation service to unvoid a void document. Properties
Methods
UnvoidRequestglobal UnvoidRequest() UnvoidRequestglobal UnvoidRequest(fferpcore.TaxCalculationService.DocumentIdentity document) Construct an unvoid request for an existing void document. Input Parameters
fferpcore.TaxCalculationService.UnvoidResponseglobal class UnvoidResponse extends Response Data returned from the external tax provider following the unvoiding of a document. This class extends fferpcore.TaxCalculationService.Response Properties
MethodsUnvoidResponseglobal UnvoidResponse() fferpcore.TaxCalculationService.VerifyRequestglobal class VerifyRequest Data provided to the external tax calculation service to verify a document. Properties
MethodsVerifyRequestglobal VerifyRequest() fferpcore.TaxCalculationService.VerifyResponseglobal class VerifyResponse extends Response Data returned from the external tax provider following the verifying of a document. This class extends fferpcore.TaxCalculationService.Response Properties
MethodsVerifyResponseglobal VerifyResponse() |