AmountDetailsResponse Class

Sets tax amount fields based on a response from the external tax engine.

Namespace

CommerceTax

Example

In this example, an instance of AmountDetailsResponse class in a mock adapter calculates several tax amount fields. The totalTax and totalAmount parameters were defined in an instance of LineItemResponse class. The adapter then assigns the instance to lineItemResponse.

1commercetax.AmountDetailsResponse amountResponse = new commercetax.AmountDetailsResponse();
2amountResponse.setTotalAmountWithTax(totalTax+totalAmount);
3amountResponse.setExemptAmount(0);
4amountResponse.setTotalAmount(totalAmount);
5amountResponse.setTaxAmount(totalTax);
6lineItemResponse.setAmountDetails(amountResponse);

AmountDetailsResponse Methods

Learn more about the methods available from the AmountDetailsResponse class.

The following are methods for AmountDetailsResponse.

setExemptAmount(exemptAmount)

Sets the value of the ExemptAmount field.

Signature

global void setExemptAmount(Double exemptAmount)

Parameters

exemptAmount
Type: Double
The amount of a line item's total amount that's exempt from tax calculation.

Return Value

Type: void

setTaxAmount(taxAmount)

Sets the value of the TaxAmount field.

Signature

global void setTaxAmount(Double taxAmount)

Parameters

taxAmount
Type: Double
The calculated amount of tax for a line item.

Return Value

Type: void

setTotalAmount(totalAmount)

Sets the value of the TotalAmount field.

Signature

global void setTotalAmount(Double totalAmount)

Parameters

totalAmount
Type: Double
The total amount of a line item, excluding tax.

Return Value

Type: void

setTotalAmountWithTax(totalAmtWithTax)

Sets the value of the TotalAmountWithTax field.

Signature

global void setTotalAmountWithTax(Double totalAmtWithTax)

Parameters

totalAmtWithTax
Type: Double
The total amount of a line item combined with the calculated tax for that line item.

Return Value

Type: void