TaxDetailsResponse Class
Namespace
Usage
Example
List<commercetax.TaxDetailsResponse> taxDetailsResponses = new List<commercetax.TaxDetailsResponse>();
for(integer i =0;i<1;i++){
Integer rate = 1;
Double taxableAmount = lineItem.amount;
commercetax.TaxDetailsResponse taxDetailsResponse = new commercetax.TaxDetailsResponse();
taxDetailsResponse.setRate(Double.valueOf(rate));
taxDetailsResponse.setTaxableAmount(taxableAmount);
Double tax = taxableAmount*rate;
totalLineTax+=tax;
taxDetailsResponse.setTax(taxableAmount*rate);
taxDetailsResponse.setExemptAmount(0);
taxDetailsResponse.setExemptReason('exemptReason');
taxDetailsResponse.setTaxRegionId('taxRegionId');
taxDetailsResponse.setTaxId(String.valueOf(getRandomInteger(0,2323233)));
taxDetailsResponse.setSerCode('serCode');
taxDetailsResponse.setTaxAuthorityTypeId('taxAuthorityTypeId');
if(request.DocumentCode == 'SetsNullForResponseWithoutException'){
taxDetailsResponse.setImposition(null);
}else{
commercetax.ImpositionResponse imposition = new commercetax.ImpositionResponse();
imposition.setSubType('subtype');
imposition.setType('type');
taxDetailsResponse.setImposition(imposition);
}
if(request.DocumentCode == 'SetsNullForResponseWithoutException'){
taxDetailsResponse.setJurisdiction(null);
}else{
commercetax.JurisdictionResponse jurisdiction = new commercetax.JurisdictionResponse();
jurisdiction.setCountry('country');
jurisdiction.setRegion('region');
jurisdiction.setName('name');
jurisdiction.setStateAssignedNumber('stateAssignedNo');
jurisdiction.setId('id');
jurisdiction.setLevel('level');
taxDetailsResponse.setJurisdiction(jurisdiction);
}
taxDetailsResponses.add(taxDetailsResponse);
}
lineItemResponse.setTaxes(taxDetailsResponses);
totalTax +=totalLineTax;
totalAmount+=lineItem.amount;
TaxDetailsResponse Methods
The TaxDetailsResponse class includes these methods.
setExemptAmount(exemptAmount)
Signature
global void setExemptAmount(Double exemptAmount)
Parameters
- exemptAmount
- Type: Double
- Amount of tax on a line item that is exempt from tax calculation.
Return Value
Type: void
setExemptReason(reason)
Signature
global void setExemptReason(String reason)
Parameters
- reason
- Type: String
- Optional user-defined information on why a tax exemption applies to a line item.
Return Value
Type: void
setImposition(imposition)
Signature
global void setImposition(commercetax.ImpositionResponse imposition)
Parameters
- imposition
- Type: ImpositionResponse
- Contains information about why tax was imposed on a line item.
Return Value
Type: void
setJurisdiction(jurisdiction)
Signature
global void setJurisdiction(commercetax.JurisdictionResponse jurisdiction)
Parameters
- jurisdiction
- Type: JurisdictionResponse
- Contains address information about the tax jurisdiction used in the tax calculation process.
Return Value
Type: void
setRate(rate)
Signature
global void setRate(Double rate)
Parameters
- rate
- Type: Double
- Tax used during tax calculation. This value is often a decimal amount, such as 0.1 or 0.06, based on the applied tax percentage.
Return Value
Type: void
setSerCode(serCode)
Signature
global void setSerCode(String serCode)
Parameters
- serCode
- Type: String
- Service code used in tax calculation.
Return Value
Type: void
setTax(tax)
Signature
global void setTax(Double tax)
Parameters
- tax
- Type: Double
- Amount of tax for a line item.
Return Value
Type: void
setTaxAuthorityTypeId(taxAuthorityTypeId)
Signature
global void setTaxAuthorityTypeId(String taxAuthorityTypeId)
Parameters
- taxAuthorityTypeId
- Type: String
- ID of the organization that oversees tax collection.
Return Value
Type: void
setTaxId(taxId)
Signature
global void setTaxId(String taxId)
Parameters
- taxId
- Type: String
- ID value used to determine the tax for an individual or business.
Return Value
Type: void
setTaxRegionId(taxRegionId)
Signature
global void setTaxRegionId(String taxRegionId)
Parameters
- taxRegionId
- Type: String
- ID of the tax region used in tax calculation. A tax region represents a geographical area where tax is applied.
Return Value
Type: void
setTaxRuleDetails(taxRuleDetails)
Signature
global void setTaxRuleDetails(commercetax.RuleDetailsResponse taxRuleDetails)
Parameters
- taxRuleDetails
- Type: RuleDetailsResponse
- Information about the Salesforce tax rules used during tax calculation.
Return Value
Type: void
setTaxableAmount(taxableAmount)
Signature
global void setTaxableAmount(Double taxableAmount)
Parameters
- taxableAmount
- Type: Double
- Amount that can be taxed on a line item.
Return Value
Type: void