Newer Version Available
LineItemResponse Class
Namespace
Example
This example uses a LineItemResponse list to store information about each line item that was processed as part of the request. For simplicity, the sample code uses a static value of 1 for the tax rate. However, most integrations typically have a more complex process for determining a tax rate. Most integrations also build a TaxDetailsResponse list to store the actual tax value information that they assign to each line item in the LineItemResponse list.
LineItemResponse Methods
The LineItemResponse class includes these methods.
setAddresses(addresses)
Signature
global void setAddresses(commercetax.AddressesResponse addresses)
Parameters
- addresses
- Type: AddressesResponse
- Class that contains methods to set the Ship To, Ship From, and Sold To address information.
Return Value
Type: void
setAmountDetails(amountDetails)
Signature
global void setAmountDetails(commercetax.AmountDetailsResponse amountDetails)
Parameters
- amountDetails
- Type: AmountDetailsResponse
- Class that contains methods to set the tax amount, total amount with tax, total amount, and exempt amount.
Return Value
Type: void
setCustomTaxAttributes(customTaxAttributes)
Signature
global void setCustomTaxAttributes(commercetax.CustomTaxAttributesResponse customTaxAttributes)
Parameters
- customTaxAttributes
- Type: CustomTaxAttributesResponse
- Additional data or custom attributes to include in the tax response.
Return Value
Type: void
setEffectiveDate(effectiveDate)
Signature
global void setEffectiveDate(Datetime effectiveDate)
Parameters
- effectiveDate
- Type: Datetime
- Optional field that stores the date that a transaction takes effect.
Return Value
Type: void
setIsTaxable(isTaxable)
Signature
global void setIsTaxable(Boolean isTaxable)
Parameters
- isTaxable
- Type: Boolean
- Whether line items were taxed as part of the tax calculation request.
Return Value
Type: void
setLineNumber(lineNumber)
Signature
global void setLineNumber(String lineNumber)
Parameters
- lineNumber
- Type: String
- User-defined number used to identify a line item.
Return Value
Type: void
setProductCode(productCode)
Signature
global void setProductCode(String productCode)
Parameters
- productCode
- Type: String
- Code for the product that a line item represents.
Return Value
Type: void
setQuantity(quantity)
Signature
global void setQuantity(Double quantity)
Parameters
- quantity
- Type: Double
- Quantity of a line item.
Return Value
Type: void
setTaxCode(taxCode)
Signature
global void setTaxCode(String taxCode)
Parameters
- taxCode
- Type: String
- Federal code that an individual or business uses to pay their taxes to a federal or state government. The tax engine uses this code during the tax calculation process.
Return Value
Type: void
setTaxes(taxes)
Signature
global void setTaxes(List<commercetax.TaxDetailsResponse> taxes)
Parameters
- taxes
- Type: List<TaxDetailsResponse>
- Tax values applied to a line item in the LineItemResponse list. This information is stored in a list of TaxDetailsResponses, which contains values such as tax, taxable amount, and tax rate.
Return Value
Type: void