Tax calculation
Learn about how tax calculation works when you use the Salesforce Lightning app.
Last updated
Learn about how tax calculation works when you use the Salesforce Lightning app.
Last updated
Tax calculation in the Salesforce Lightning app is segregated into two separate layers. The inner layer, the DRB2B_CartTaxCalculations
class, contains both the API connector and messaging functionality.
Use the outer layer, DRB2B_TaxCalculationService
class, as a global service that can be used as a stand-alone integration. This service has a startCartProcessAsync
method which takes CartId (id)
and sfdc_checkout.IntegrationInfo
which returns a ResponseModel
custom apex object.
After making the API call to Digital River, the service uses the checkout service to store the response in the CartTax
object. The DRB2B_TaxCalculationService
service is used in both synchronous and asynchronous checkout flows.
Refer to the following example to understand how to use tax calculation in an the asynchronous checkout context:
As an alternative to the previous example, you can call the tax calculation routine yourself. Refer to the following example to understand how the service can be called in a stand-alone use case:
The following table provides details on the input parameters used in tax calculations:
Input variable name | Description |
---|---|
cartId | Type: Id Identifies the cart in the checkout session. |
jobInfo | Type: Used in cases of an asynchronous checkout process used to load exceptions and related messages into a session. This can be NULL when used as stand-alone process. |
The following table provides information on the output parameters used in tax calculations:
Variable name | Description |
---|---|
ResponseModel.status | Type: String Possible values: “Error” – This is passed when an exception or validation error occurs because the tax calculation cannot completed. “Success” – This is passed when tax calculation was success. |
ResponseModel.message | Type: String Provides the response string message passed on when there is an exception. |