Script: Class dw.order.LineItem

Class LineItem

Common line item base class.

All Known Subclasses

GiftCertificateLineItem, PriceAdjustment, ProductLineItem, ProductShippingLineItem, ShippingLineItem

Properties

basePrice : Money

The base price for the line item, which is the price of the unit before applying adjustments, in the purchase currency. The base price may be net or gross of tax depending on the configured taxation policy.

grossPrice : Money

The gross price for the line item, which is the price of the unit before applying adjustments, in the purchase currency, including tax.

lineItemCtnr : LineItemCtnr Read Only

The line item ctnr of the line item.

lineItemText : String

The display text for the line item.

netPrice : Money

The net price for the line item, which is the price of the unit before applying adjustments, in the purchase currency, excluding tax.

price : Money Read Only

Get the price of the line item. If the line item is based on net pricing then the net price is returned. If the line item is based on gross pricing then the gross price is returned.

priceValue : Number

Return the price amount for the line item. Same as getPrice().getValue().

tax : Money

The tax for the line item, which is the tax of the unit before applying adjustments, in the purchase currency.

taxBasis : Money Read Only

Get the price used to calculate the tax for this line item.

taxClassID : String

The tax class ID for the line item or null if no tax class ID is associated with the line item. In the case where the tax class ID is null, you should use the default tax class ID.

taxRate : Number

The tax rate, which is the decimal tax rate to be applied to the product represented by this line item. A value of 0.175 represents a percentage of 17.5%.

Constructor Summary

This class does not have a constructor, so you cannot create it directly. To get an instance of this class, use one of the subclass constructors.

Method Summary

getBasePrice() : Money

Returns the base price for the line item, which is the price of the unit before applying adjustments, in the purchase currency.

getGrossPrice() : Money

Returns the gross price for the line item, which is the price of the unit before applying adjustments, in the purchase currency, including tax.

getLineItemCtnr() : LineItemCtnr

Returns the line item ctnr of the line item.

getLineItemText() : String

Returns the display text for the line item.

getNetPrice() : Money

Returns the net price for the line item, which is the price of the unit before applying adjustments, in the purchase currency, excluding tax.

getPrice() : Money

Get the price of the line item.

getPriceValue() : Number

Return the price amount for the line item.

getTax() : Money

Returns the tax for the line item, which is the tax of the unit before applying adjustments, in the purchase currency.

getTaxBasis() : Money

Get the price used to calculate the tax for this line item.

getTaxClassID() : String

Returns the tax class ID for the line item or null if no tax class ID is associated with the line item.

getTaxRate() : Number

Returns the tax rate, which is the decimal tax rate to be applied to the product represented by this line item.

setBasePrice(aValue : Money) : void

Sets the base price for the line item, which is the price of the unit before applying adjustments, in the purchase currency.

setGrossPrice(aValue : Money) : void

Sets the gross price for the line item, which is the Price of the unit before applying adjustments, in the purchase currency, including tax.

setLineItemText(aText : String) : void

Sets the display text for the line item.

setNetPrice(aValue : Money) : void

Sets the value for the net price, which is the price of the unit before applying adjustments, in the purchase currency, excluding tax.

setPriceValue(value : Number) : void

Sets price attributes of the line item based on the current purchase currency and taxation policy.

setTax(aValue : Money) : void

Sets the value for the tax of the line item, which is the the tax of the unit before applying adjustments, in the purchase currency.

setTaxClassID(aValue : String) : void

Sets the tax class ID for the line item.

setTaxRate(taxRate : Number) : void

Sets the tax rate, which is the decimal tax rate to be applied to the product represented by this line item.

updatePrice(price : Money) : void

Updates the price attributes of the line item based on the specified price.

updateTax(taxRate : Number) : void

Updates the tax-related attributes of the line item based on the specified tax rate, a tax basis determined by the system and the "Tax Rounding Mode" order preference.

updateTax(taxRate : Number, taxBasis : Money) : void

Updates the tax-related attributes of the line item based on the specified tax rate, the passed tax basis and the "Tax Rounding Mode" order preference.

updateTaxAmount(tax : Money) : void

Updates tax amount of the line item setting the provided value.

Methods inherited from class ExtensibleObject

describe, getCustom

Methods inherited from class PersistentObject

getCreationDate, getLastModified, getUUID

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Method Detail

getBasePrice

getBasePrice() : Money

Returns the base price for the line item, which is the price of the unit before applying adjustments, in the purchase currency. The base price may be net or gross of tax depending on the configured taxation policy.

Returns:

the base price for the line item.

getGrossPrice

getGrossPrice() : Money

Returns the gross price for the line item, which is the price of the unit before applying adjustments, in the purchase currency, including tax.

Returns:

the value of the gross price.


getLineItemCtnr

getLineItemCtnr() : LineItemCtnr

Returns the line item ctnr of the line item.

Returns:

Line item ctnr of the line item


getLineItemText

getLineItemText() : String

Returns the display text for the line item.

Returns:

the display text.


getNetPrice

getNetPrice() : Money

Returns the net price for the line item, which is the price of the unit before applying adjustments, in the purchase currency, excluding tax.

Returns:

the value for the net price.


getPrice

getPrice() : Money

Get the price of the line item. If the line item is based on net pricing then the net price is returned. If the line item is based on gross pricing then the gross price is returned.

Returns:

either the net or the gross price


getPriceValue

getPriceValue() : Number

Return the price amount for the line item. Same as getPrice().getValue().

Returns:

the price for the line item


getTax

getTax() : Money

Returns the tax for the line item, which is the tax of the unit before applying adjustments, in the purchase currency.

Returns:

the tax for the line item.


getTaxBasis

getTaxBasis() : Money

Get the price used to calculate the tax for this line item.

Returns:

The tax basis used to calculate tax for this line item, or Money.NOT_AVAILABLE if tax has not been set for this line item yet.


getTaxClassID

getTaxClassID() : String

Returns the tax class ID for the line item or null if no tax class ID is associated with the line item. In the case where the tax class ID is null, you should use the default tax class ID.

Returns:

the tax class ID for the line item or null if no tax class ID is associated with the line item.

See Also:

TaxMgr.getDefaultTaxClassID()


getTaxRate

getTaxRate() : Number

Returns the tax rate, which is the decimal tax rate to be applied to the product represented by this line item. A value of 0.175 represents a percentage of 17.5%.

Returns:

the value of the tax rate.


setBasePrice

setBasePrice(aValue : Money) : void

Sets the base price for the line item, which is the price of the unit before applying adjustments, in the purchase currency. The base price may be net or gross of tax depending on the configured taxation policy.

Deprecated:

Use updatePrice(Money) instead.

Parameters:

aValue - the new value of the base price.


setGrossPrice

setGrossPrice(aValue : Money) : void

Sets the gross price for the line item, which is the Price of the unit before applying adjustments, in the purchase currency, including tax.

Deprecated:

Use updatePrice(Money) which sets the base price and also the gross price if the line item is based on gross pricing.

Parameters:

aValue - the new value of the attribute


setLineItemText

setLineItemText(aText : String) : void

Sets the display text for the line item.

Parameters:

aText - line item text.


setNetPrice

setNetPrice(aValue : Money) : void

Sets the value for the net price, which is the price of the unit before applying adjustments, in the purchase currency, excluding tax.

Deprecated:

Use updatePrice(Money) which sets the base price and also the net price if the line item is based on net pricing.

Parameters:

aValue - the new value for the net price


setPriceValue

setPriceValue(value : Number) : void

Sets price attributes of the line item based on the current purchase currency and taxation policy.
The methods sets the 'basePrice' attribute of the line item. Additionally, it sets the 'netPrice' attribute of the line item if the current taxation policy is 'net', and the 'grossPrice' attribute, if the current taxation policy is 'gross'.
If null is specified as value, the price attributes are reset to Money.NOT_AVAILABLE.

Parameters:

value - Price value or null


setTax

setTax(aValue : Money) : void

Sets the value for the tax of the line item, which is the the tax of the unit before applying adjustments, in the purchase currency.

Parameters:

aValue - the new value for the tax.


setTaxClassID

setTaxClassID(aValue : String) : void

Sets the tax class ID for the line item.

Parameters:

aValue - the tax class ID for the line item.


setTaxRate

setTaxRate(taxRate : Number) : void

Sets the tax rate, which is the decimal tax rate to be applied to the product represented by this line item. A value of 0.175 represents a percentage of 17.5%.

Parameters:

taxRate - the new value for the tax rate.


updatePrice

updatePrice(price : Money) : void

Updates the price attributes of the line item based on the specified price. The base price is set to the specified value. If the line item is based on net pricing then the net price attribute is set. If the line item is based on gross pricing then the gross price attribute is set. Whether or not a line item is based on net or gross pricing is a site-wide configuration parameter.

Deprecated:

Use setPriceValue(Number) instead.

Parameters:

price - The price to use when performing the update. This price must not be null and must either be equal to NOT_AVAIALBLE or must have a currency code equal to that of the parent container.


updateTax

updateTax(taxRate : Number) : void

Updates the tax-related attributes of the line item based on the specified tax rate, a tax basis determined by the system and the "Tax Rounding Mode" order preference. This method sets the tax basis as an attribute, and is not affected by the previous value of this attribute.

The value used as a basis depends on the type of line item this is and on the promotion preferences for the current site. If you tax products, shipping, and discounts based on price (default), then the tax basis will simply be equal to getPrice(). If you tax products and shipping only based on adjusted price, then the tax basis depends upon line item type as follows:

If null is passed as tax rate, tax-related attribute fields are set to N/A.

Parameters:

taxRate - taxRate the tax rate to use or null.


updateTax

updateTax(taxRate : Number, taxBasis : Money) : void

Updates the tax-related attributes of the line item based on the specified tax rate, the passed tax basis and the "Tax Rounding Mode" order preference. If null is passed as tax rate or tax basis, tax-related attribute fields are set to N/A.

Parameters:

taxRate - the tax rate to use or null.

taxBasis - the tax basis to use or null.


updateTaxAmount

updateTaxAmount(tax : Money) : void

Updates tax amount of the line item setting the provided value. Depending on the way how the tax is calculated (based on net or gross price), the corresponding gross or net price is updated accordingly. For tax calculation based on net price, the gross price is calculated by adding the tax to the net price. For tax calculation based on gross price, the net price is calculated by subtracting the tax from the gross price.

If null is passed as tax amount, the item tax and resulting net or gross price are set to N/A.

Note that tax rate is not calculated and it is not updated.

Parameters:

tax - the tax amount of the line item to set