Tax calculation
Learn about how tax calculation works when you use the Salesforce Lightning app.
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:
The following table provides information on the output parameters used in tax calculations:
Last updated