Script: Class dw.order.ReturnItem

Class ReturnItem

An item of a Return, created using Return.createItem(String). Represents a physically returned order line item. Please refer to the documentation of ReturnHooks for further information.
When the related Return were set to status COMPLETED, only the the custom attributes of the return item can be changed.

Order post-processing APIs (gillian) are now inactive by default and will throw an exception if accessed. Activation needs preliminary approval by Product Management. Please contact support in this case. Existing customers using these APIs are not affected by this change and can use the APIs until further notice.

Properties

basePrice : Money Read Only

Price of a single unit before discount application.

note : String

Return the note for this return item.

parentItem : ReturnItem

Returns null or the parent item.

reasonCode : EnumValue

The reason code for return item. The list of reason codes can be updated by updating meta-data for ReturnItem.

returnCaseItem : ReturnCaseItem Read Only

The return case item related to this item. Should never return null.

returnedQuantity : Quantity

The Quantity returned. This may return an N/A quantity.

returnNumber : String Read Only

The mandatory returnNumber of the Return to which this item belongs.

Constructor Summary

This class does not have a constructor, so you cannot create it directly.

Method Summary

addTaxItem(amount : Decimal, taxGroup : TaxGroup) : TaxItem

Create a new tax-item and add to this item.

applyPriceRate(factor : Decimal, divisor : Decimal, roundUp : boolean) : void

Apply a rate of (factor / divisor) to the prices in this item, with the option to half round up or half round down to the nearest cent if necessary.

getBasePrice() : Money

Price of a single unit before discount application.

getNote() : String

Return the note for this return item.

getParentItem() : ReturnItem

Returns null or the parent item.

getReasonCode() : EnumValue

Returns the reason code for return item.

getReturnCaseItem() : ReturnCaseItem

Returns the return case item related to this item.

getReturnedQuantity() : Quantity

The Quantity returned.

getReturnNumber() : String

The mandatory returnNumber of the Return to which this item belongs.

setNote(note : String) : void

Sets a note for this return item.

setParentItem(parentItem : ReturnItem) : void

Set a parent item.

setReasonCode(reasonCode : String) : void

Set the reason code.

setReturnedQuantity(quantity : Quantity) : void

Set the Quantity returned.

setTaxBasis(taxBasis : Money) : void

Set the tax-basis price for this item.

setTaxItems(taxItems : Collection) : void

Set the tax-items for this item.

Methods inherited from class AbstractItem

getGrossPrice, getItemID, getLineItem, getNetPrice, getOrderItem, getOrderItemID, getTax, getTaxBasis, getTaxItems

Methods inherited from class Extensible

describe, getCustom

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

addTaxItem

addTaxItem(amount : Decimal, taxGroup : TaxGroup) : TaxItem

Create a new tax-item and add to this item.

Parameters:

amount - amount to assign to the tax-item

taxGroup - the TaxGroup to which the item belongs

Returns:

the new tax-item

applyPriceRate

applyPriceRate(factor : Decimal, divisor : Decimal, roundUp : boolean) : void

Apply a rate of (factor / divisor) to the prices in this item, with the option to half round up or half round down to the nearest cent if necessary.

Examples:

TaxBasis beforefactordivisorroundupCalculationTaxBasis after
$10.0012true10*1/2=$5.00
$10.00910true10*9/10=$9.00
$10.0013true10*1/3=3.3333=$3.33
$2.4712true2.47*1/2=1.235=$1.24
$2.4712false2.47*1/2=1.235=$1.23

Which prices are updated?:
The rate described above is applied to tax-basis and tax then the net-price and gross-price are recalculated by adding / subtracting depending on whether the order is based on net price.

Example (order based on net price)
New TaxBasis:$10.00, Tax:$1.00, NetPrice=TaxBasis=$10.00, GrossPrice=TaxBasis+Tax=$11.00

Example (order based on gross price)
New TaxBasis:$10.00, Tax:$1.00, NetPrice=TaxBasis-tax=$9.00, GrossPrice=TaxBasis=$10.00

Parameters:

factor - factor used to calculate rate

divisor - divisor used to calculate rate

roundUp - whether to round up or down on 0.5

See Also:

AbstractItem.getTaxBasis()

AbstractItem.getTax()

AbstractItem.getNetPrice()

AbstractItem.getGrossPrice()

TaxMgr.getTaxationPolicy()


getBasePrice

getBasePrice() : Money

Price of a single unit before discount application.

Returns:

Price of a single unit before discount application.


getNote

getNote() : String

Return the note for this return item.

Returns:

the note or null


getParentItem

getParentItem() : ReturnItem

Returns null or the parent item.

Returns:

null or the parent item.


getReasonCode

getReasonCode() : EnumValue

Returns the reason code for return item. The list of reason codes can be updated by updating meta-data for ReturnItem.

Returns:

the return reason code


getReturnCaseItem

getReturnCaseItem() : ReturnCaseItem

Returns the return case item related to this item. Should never return null.

Returns:

the return case item related to this item


getReturnedQuantity

getReturnedQuantity() : Quantity

The Quantity returned. This may return an N/A quantity.

Returns:

the quantity returned, may be N/A


getReturnNumber

getReturnNumber() : String

The mandatory returnNumber of the Return to which this item belongs.

Returns:

the returnNumber of the Return to which this item belongs


setNote

setNote(note : String) : void

Sets a note for this return item.

Parameters:

note - the note for this return item to set


setParentItem

setParentItem(parentItem : ReturnItem) : void

Set a parent item. The parent item must belong to the same Return. An infinite parent-child loop is disallowed as is a parent-child depth greater than 10. Setting a parent item indicates a dependency of the child item on the parent item, and can be used to form a parallel structure to that accessed using ProductLineItem.getParent().

Parameters:

parentItem - The parent item, null is allowed


setReasonCode

setReasonCode(reasonCode : String) : void

Set the reason code. The list of reason codes can be updated by updating meta-data for ReturnItem.

Parameters:

reasonCode - the reason code to set


setReturnedQuantity

setReturnedQuantity(quantity : Quantity) : void

Set the Quantity returned. Passing null results in an exception being thrown. The quantity must be higher than zero and not be higher than the remaining quantity to return.

The item prices are recalculated in this method as described in applyPriceRate(Decimal, Decimal, Boolean) with the quantity argument as the factor, and ordered quantity as divisor and true as the roundup parameter.

Parameters:

quantity - the quantity returned, null not allowed

See Also:

OrderItem.getReturnedQuantity()

ProductLineItem.getQuantity()


setTaxBasis

setTaxBasis(taxBasis : Money) : void

Set the tax-basis price for this item.

Parameters:

taxBasis - the tax basis value.


setTaxItems

setTaxItems(taxItems : Collection) : void

Set the tax-items for this item.

Parameters:

taxItems - items

See Also:

addTaxItem(Decimal, TaxGroup)

TaxGroup.create(String, String, String, Decimal)