Newer Version Available

This content describes an older version of this product. View Latest

CalculateTaxResponse Class

Sets the values of the tax transaction following a response from the external tax engine. Extends the AbstractTransactionResponse class and is the top-level response class.

Namespace

CommerceTax

Example

CalculateTaxResponse Methods

Learn more about the available methods with the CalculateTaxResponse class.

The CalculateTaxResponse class includes these methods.

setAddresses(addresses)

Sets the value of the Addresses field using the addresses contained in an instance of the AddressesResponse class.

Signature

global void setAddresses(commercetax.AddressesResponse addresses)

Parameters

addresses
Type: AddressesResponse
Contains Ship To, Ship From, and Sold To addresses.

Return Value

Type: void

setAmountDetails(amountDetails)

Sets the value of the AmountDetails field using an instance of AmountDetailsResponse.

Signature

global void setAmountDetails(commercetax.AmountDetailsResponse amountDetails)

Parameters

amountDetails
Type: AmountDetailsResponse
The tax amount details for a line item on which tax was calculated.

Return Value

Type: void

setCurrencyIsoCode(currencyIsoCode)

Sets the value of the CurrencyIsoCode field of the CalculateTaxResponse object.

Signature

global void setCurrencyIsoCode(String currencyIsoCode)

Parameters

currencyIsoCode
Type: String
Three-letter ISO 4217 currency code associated with a tax object.

Return Value

Type: void

setDescription(dscptn)

Sets the value of the Description field of the CalculateTaxResponse object.

Signature

global void setDescription(String dscptn)

Parameters

dscptn
Type: String
Optional description for providing more information about the calculate tax response.

Return Value

Type: void

setDocumentCode(documentCode)

Sets the value of the DocumentCode field of the CalculateTaxResponse object.

Signature

global void setDocumentCode(String documentCode)

Parameters

documentCode
Type: String
Code for a tax document that’s created by the tax engine for the calculation process.

Return Value

Type: void

setEffectiveDate(effectiveDate)

Sets the value of the EffectiveDate field of the CalculateTaxResponse object.

Signature

global void setEffectiveDate(Datetime effectiveDate)

Parameters

effectiveDate
Type: Datetime
The date a tax calculation action takes effect. This parameter is optional and is provided only for recordkeeping purpose. Additionally, this parameter is used to determine the tax rates or rules and overrides the transaction date. For example, if the tax calculation request is placed on January 3 and the transaction date is January 1, you can set the effective date as January 1.

Return Value

Type: void

setLineItems(lineItems)

Sets the value of the LineItems field of the CalculateTaxResponse object.

Signature

global void setLineItems(List<commercetax.LineItemResponse> lineItems)

Parameters

lineItems
Type: List<LineItemResponse>
Response object that the tax adapter populates from the response of the external tax engine.

Return Value

Type: void

setReferenceDocumentCode(referenceDocumentCode)

Sets the value of the ReferenceDocumentCode field of the CalculateTaxResponse object.

Signature

global void setReferenceDocumentCode(String referenceDocumentCode)

Parameters

referenceDocumentCode
Type: String
Code for a reference document used in the tax calculation process.

Return Value

Type: void

setReferenceEntityId(referenceEntityId)

Sets the value of the ReferenceEntityId field of the CalculateTaxResponse object.

Signature

global void setReferenceEntityId(String referenceEntityId)

Parameters

referenceEntityId
Type: String
ID of an entity related to the line items submitted for tax calculation. For example, if order items were sent for tax calculation, you could use the ID of their parent order.

Return Value

Type: void

setStatus(status)

Sets the value of the Status field of the CalculateTaxResponse object.

Signature

global void setStatus(commercetax.TaxTransactionStatus status)

Parameters

status
Type: TaxTransactionStatus
Indicates whether a tax transaction has been committed.

Return Value

Type: void

setStatusDescription(statusDescription)

Sets the value of the StatusDescription field of the CalculateTaxResponse object.

Signature

global void setStatusDescription(String statusDescription)

Parameters

statusDescription
Type: String
Optional value for providing more information about a tax transaction's status.

Return Value

Type: void

setTaxTransactionId(taxTrxnId)

Sets the value of the TaxTransactionId field of the CalculateTaxResponse object.

Signature

public void setTaxTransactionId(String taxTrxnId)

Parameters

taxTrxnId
Type: String
The ID of the Salesforce tax transaction entity that stores information about the tax calculation transaction.

Return Value

Type: void

setTaxTransactionType(taxTransactionType)

Sets the value of the TaxTransactionType field of the CalculateTaxResponse object.

Signature

global void setTaxTransactionType(commercetax.TaxTransactionType taxTransactionType)

Parameters

taxTransactionType
Type: TaxTransactionType
Whether the tax transaction was for a credit, debit, or voided transaction.

Return Value

Type: void

setTaxType(taxType)

Sets the value of the TaxType field of the CalculateTaxResponse object.

Signature

global void setTaxType(commercetax.CalculateTaxType taxType)

Parameters

taxType
Type: CalculateTaxType
Indicates whether a tax calculation request is for estimated or actual tax.

Return Value

Type: void

setTransactionDate(transactionDate)

Sets the value of the TransactionDate field of the CalculateTaxResponse object.

Signature

global void setTransactionDate(Datetime transactionDate)

Parameters

transactionDate
Type: Datetime
The date that the tax transaction occurred.

Return Value

Type: void