LineItemResponse Class
Response class that stores details of a list of one or more line items on which the tax engine has calculated tax.
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.
-
Learn more about the available methods with the
LineItemResponseclass.
Learn more about the available methods with the LineItemResponse class.
The LineItemResponse class includes these methods.
-
Sets the Addresses field on the
LineItemResponseusing an instance ofAddressesResponseclass. -
setAmountDetails(amountDetails)
Sets the Amount Details field on the
LineItemResponseusing an instance ofAmountDetails. -
setCustomTaxAttributes(customTaxAttributes)
Uses an instance of
CustomTaxAttributesResponseclass to include additional attributes in the tax response at line item level. -
setEffectiveDate(effectiveDate)
Sets the EffectiveDate field on the
LineItemResponseclass. Effective Date fields are optional fields that store the date that a transaction takes effect. We provide these fields only for recordkeeping purposes – for example, if you must report an effective date to an external general ledger system. Salesforce doesn’t use them to calculate any tax or payment values. -
Sets the IsTaxable field on the
LineItemResponseclass. -
Sets the LineNumber field on the
LineItemResponseclass. -
Sets the ProductCode field on the
LineItemResponseclass. -
Sets the Quantity field on the
LineItemResponseclass. -
Sets the TaxCode field on the
LineItemResponse. -
Sets the Taxes field on a
LineItemResponse.
Sets the Addresses field on the LineItemResponse using an instance of AddressesResponse class.
global void setAddresses(commercetax.AddressesResponse addresses)
-
addresses:
Type: AddressesResponse
Class that contains methods to set the Ship To, Ship From, and Sold To address information.
Type: void
Sets the Amount Details field on the LineItemResponse using an instance of AmountDetails.
global void setAmountDetails(commercetax.AmountDetailsResponse amountDetails)
-
amountDetails:
Type: AmountDetailsResponse
Class that contains methods to set the tax amount, total amount with tax, total amount, and exempt amount.
Type: void
Uses an instance of CustomTaxAttributesResponse class to include additional attributes in the tax response at line item level.
global void setCustomTaxAttributes(commercetax.CustomTaxAttributesResponse customTaxAttributes)
-
customTaxAttributes:
Type: CustomTaxAttributesResponse
Additional
data or custom attributes to include in the tax response.
Type: void
Sets the EffectiveDate field on the LineItemResponse class. Effective Date fields are optional fields that store the date that a transaction takes effect. We provide these fields only for recordkeeping purposes – for example, if you must report an effective date to an external general ledger system. Salesforce doesn’t use them to calculate any tax or payment values.
global void setEffectiveDate(Datetime effectiveDate)
-
effectiveDate:
Type: Datetime
Optional field that stores the date that a transaction takes effect.
Type: void
Sets the IsTaxable field on the LineItemResponse class.
global void setIsTaxable(Boolean isTaxable)
-
isTaxable:
Type: Boolean
Whether line items were taxed as part of the tax calculation request.
Type: void
Sets the LineNumber field on the LineItemResponse class.
global void setLineNumber(String lineNumber)
-
lineNumber:
Type: String
User-defined number used to identify
a line item.
Type: void
Sets the ProductCode field on the LineItemResponse class.
global void setProductCode(String productCode)
-
productCode:
Type: String
Code
for the product that a line item represents.
Type: void
Sets the Quantity field on the LineItemResponse class.
global void setQuantity(Double quantity)
-
quantity:
Type: Double
Quantity of a line item.
Type: void
Sets the TaxCode field on the LineItemResponse.
global void setTaxCode(String taxCode)
-
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.
Type: void
Sets the Taxes field on a LineItemResponse.
global void setTaxes(List<commercetax.TaxDetailsResponse> taxes)
-
taxes:
Type: List<TaxDetailsResponse>
Tax values applied to a line item in the
LineItemResponselist. This information is stored in a list ofTaxDetailsResponses, which contains values such as tax, taxable amount, and tax rate.
Type: void