Script: Class dw.order.OrderItem

Class OrderItem

Defines extensions to ProductLineItems and ShippingLineItems belonging to an order.

The order-item can be accessed using ProductLineItem.getOrderItem() or ShippingLineItem.getOrderItem() - these methods return null if the item is associated with a basket rather than an order. Alternative access is available using Order.getOrderItem(String) by passing the itemID used to identify the order-item in for example export files. The associated order-item can also be accessed from invoice-items, shipping-order-items, return-items and return-case-items using AbstractItem.getOrderItem().

The order-item provides an item-level status and type, methods for accessing and creating associated items, and methods used to allocate inventory for shipping-order creation.

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.

Constants

STATUS_BACKORDER : String = "BACKORDER"

Constant for Order Item Status BACKORDER

STATUS_CANCELLED : String = "CANCELLED"

Constant for Order Item Status CANCELLED

STATUS_CONFIRMED : String = "CONFIRMED"

Constant for Order Item Status CONFIRMED

STATUS_CREATED : String = "CREATED"

Constant for Order Item Status CREATED

STATUS_NEW : String = "NEW"

Constant for Order Item Status NEW

STATUS_OPEN : String = "OPEN"

Constant for Order Item Status OPEN

STATUS_SHIPPED : String = "SHIPPED"

Constant for Order Item Status SHIPPED

STATUS_WAREHOUSE : String = "WAREHOUSE"

Constant for Order Item Status WAREHOUSE

TYPE_PRODUCT : String = "PRODUCT"

Constant for Order Item Type PRODUCT

TYPE_SERVICE : String = "SERVICE"

Constant for Order Item Type SERVICE

Properties

appeasedAmount : Money Read Only

Sum of amounts appeased for this item, calculated by iterating over invoice items associated with the item.

capturedAmount : Money Read Only

Sum of amounts captured for this item, calculated by iterating over invoice items associated with the item.

invoiceItems : Collection Read Only

All invoice items associated with this item, each InvoiceItem will belong to a different Invoice, which can also be accessed using Order.getInvoices() or Order.getInvoice(String).

itemID : String Read Only

The itemID used to identify the OrderItem. Note this is not a UUID, it is created internally when the OrderItem instance is created, and is typically used within export files to identify the item.

lineItem : LineItem Read Only

The line item which is being extended by this instance.

refundedAmount : Money Read Only

Sum of amounts refunded for this item, calculated by iterating over invoice items associated with the item.

returnCaseItems : Collection Read Only

All return case items associated with this item, each ReturnCaseItem will belong to a different ReturnCase, which can also be accessed using Order.getReturnCases() or Order.getReturnCase(String).

returnedQuantity : Quantity Read Only

The quantity returned, dynamically sum of quantities held by associated ReturnItems.

shippingOrderItem : ShippingOrderItem Read Only

The last added non-cancelled shipping order item if one exists, otherwise null.

Multiple shipping order items that are not in status ShippingOrderItem.STATUS_CANCELLED can exist for one OrderItem, for example if the OrderItem has been split for shipping purposes. The method returns null if no non-cancelled shipping order item exists.

Deprecated:

This item is deprecated.

shippingOrderItems : Collection Read Only

A collection of the ShippingOrderItems created for this item. ShippingOrder items represents the whole or part of this item which could be delivered, and belong to a shipping order. Note that the cancelled shipping order items are returned too. This method is equivalent to getShippingOrderItems(Boolean) called with parameter true.

splitItems : Collection Read Only

A collection of all split OrderItems associated with this item. Inverse relation to getSplitSourceItem().

Split order items are created when

with a specified quantity less than the existing quantity of the associated ProductLineItem. In this case the associated ProductLineItem is split by creating a new ProductLineItem and associating a new ShippingOrderItem with this item. The new ShippingOrderItem receives the specified quantity and the quantity of the item is set to the remaining quantity. All split items are associated to their originating item via the "split source item" association.

splitSourceItem : OrderItem Read Only

The split source item associated with this item, if existing. Inverse relation to getSplitItems().

A split source item is associated after the successful creation of a split item with a quantity less than the existing quantity of the item to split. For details see getSplitItems().

status : EnumValue

Gets the order item status.
The possible values are:

type : EnumValue Read Only

The type of line item with which this instance is associated, one of

Constructor Summary

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

Method Summary

allocateInventory(partialAllocation : boolean) : Quantity

Please note that this method is disabled by default.

getAppeasedAmount() : Money

Sum of amounts appeased for this item, calculated by iterating over invoice items associated with the item.

getCapturedAmount() : Money

Sum of amounts captured for this item, calculated by iterating over invoice items associated with the item.

getInvoiceItems() : Collection

Returns all invoice items associated with this item, each InvoiceItem will belong to a different Invoice, which can also be accessed using Order.getInvoices() or Order.getInvoice(String).

getItemID() : String

The itemID used to identify the OrderItem.

getLineItem() : LineItem

Returns the line item which is being extended by this instance.

getRefundedAmount() : Money

Sum of amounts refunded for this item, calculated by iterating over invoice items associated with the item.

getReturnCaseItems() : Collection

Returns all return case items associated with this item, each ReturnCaseItem will belong to a different ReturnCase, which can also be accessed using Order.getReturnCases() or Order.getReturnCase(String).

getReturnedQuantity() : Quantity

The quantity returned, dynamically sum of quantities held by associated ReturnItems.

getShippingOrderItem() : ShippingOrderItem

The last added non-cancelled shipping order item if one exists, otherwise null.

getShippingOrderItems() : Collection

Returns a collection of the ShippingOrderItems created for this item.

getShippingOrderItems(includeCancelled : boolean) : Collection

Returns a collection of the ShippingOrderItems created for this item.

getSplitItems() : Collection

Returns a collection of all split OrderItems associated with this item.

getSplitSourceItem() : OrderItem

Returns the split source item associated with this item, if existing.

getStatus() : EnumValue

Gets the order item status.
The possible values are:

getType() : EnumValue

Returns the type of line item with which this instance is associated, one of

setStatus(status : String) : void

Set the status of the order item, use one of the values documented in getStatus().

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

allocateInventory

allocateInventory(partialAllocation : boolean) : Quantity

Please note that this method is disabled by default. Please contact support for enabling it.

Attempts to allocate inventory for the item and returns the quantity that could be allocated or null if no allocation was possible.

All option product line items are allocated with their parent. Note that for items with option product line items no partial allocation is possible. That means the partialAllocation parameter will in this case always be considered as false

Parameters:

partialAllocation -

  • true accept a partial allocation as a result. Partial allocation is only possible when no option product line items are included,
  • false only full allocation will be used, partial allocation will be released automatically

Returns:

  • successful: the newly allocated quantity
  • failed: null

getAppeasedAmount

getAppeasedAmount() : Money

Sum of amounts appeased for this item, calculated by iterating over invoice items associated with the item.

Returns:

Sum of amounts refunded for this item


getCapturedAmount

getCapturedAmount() : Money

Sum of amounts captured for this item, calculated by iterating over invoice items associated with the item.

Returns:

Sum of amounts captured for this item


getInvoiceItems

getInvoiceItems() : Collection

Returns all invoice items associated with this item, each InvoiceItem will belong to a different Invoice, which can also be accessed using Order.getInvoices() or Order.getInvoice(String).

Returns:

invoice items associated with this item


getItemID

getItemID() : String

The itemID used to identify the OrderItem. Note this is not a UUID, it is created internally when the OrderItem instance is created, and is typically used within export files to identify the item.

Returns:

the itemID of the OrderItem


getLineItem

getLineItem() : LineItem

Returns the line item which is being extended by this instance.

Returns:

the line item associated with this instance


getRefundedAmount

getRefundedAmount() : Money

Sum of amounts refunded for this item, calculated by iterating over invoice items associated with the item.

Returns:

Sum of amounts refunded for this item


getReturnCaseItems

getReturnCaseItems() : Collection

Returns all return case items associated with this item, each ReturnCaseItem will belong to a different ReturnCase, which can also be accessed using Order.getReturnCases() or Order.getReturnCase(String).

Returns:

return case items associated with this item


getReturnedQuantity

getReturnedQuantity() : Quantity

The quantity returned, dynamically sum of quantities held by associated ReturnItems.

Returns:

quantity returned, the sum of quantities held by associated ReturnItems


getShippingOrderItem

getShippingOrderItem() : ShippingOrderItem

The last added non-cancelled shipping order item if one exists, otherwise null.

Multiple shipping order items that are not in status ShippingOrderItem.STATUS_CANCELLED can exist for one OrderItem, for example if the OrderItem has been split for shipping purposes. The method returns null if no non-cancelled shipping order item exists.

Deprecated:

This item is deprecated.

Returns:

the last not cancelled shipping order item or null


getShippingOrderItems

getShippingOrderItems() : Collection

Returns a collection of the ShippingOrderItems created for this item. ShippingOrder items represents the whole or part of this item which could be delivered, and belong to a shipping order. Note that the cancelled shipping order items are returned too. This method is equivalent to getShippingOrderItems(Boolean) called with parameter true.

Returns:

collection of the shipping order items created for this item


getShippingOrderItems

getShippingOrderItems(includeCancelled : boolean) : Collection

Returns a collection of the ShippingOrderItems created for this item. ShippingOrder items represent the whole or part of this item which could be delivered, and belong to a shipping order. Depending on the includeCancelled parameter the cancelled shipping order items will be returned or not.

Parameters:

includeCancelled -

  • true all shipping order items, including the cancelled, created for this item will be returned
  • false only non-cancelled shipping order items created for this item will be returned

Returns:

collection of the shipping order items created for this item


getSplitItems

getSplitItems() : Collection

Returns a collection of all split OrderItems associated with this item. Inverse relation to getSplitSourceItem().

Split order items are created when

with a specified quantity less than the existing quantity of the associated ProductLineItem. In this case the associated ProductLineItem is split by creating a new ProductLineItem and associating a new ShippingOrderItem with this item. The new ShippingOrderItem receives the specified quantity and the quantity of the item is set to the remaining quantity. All split items are associated to their originating item via the "split source item" association.

Returns:

the split order items associated with this item


getSplitSourceItem

getSplitSourceItem() : OrderItem

Returns the split source item associated with this item, if existing. Inverse relation to getSplitItems().

A split source item is associated after the successful creation of a split item with a quantity less than the existing quantity of the item to split. For details see getSplitItems().

Returns:

the split source item or null


getStatus

getStatus() : EnumValue

Gets the order item status.
The possible values are:

Returns:

the status


getType

getType() : EnumValue

Returns the type of line item with which this instance is associated, one of

Returns:

the type of order item, one of TYPE_PRODUCT or TYPE_SERVICE.


setStatus

setStatus(status : String) : void

Set the status of the order item, use one of the values documented in getStatus().

If the order item has a related shipping order item (see getShippingOrderItem()) the status of the shipping order item will be adjusted to the same status. Setting the status of an order item might also change the status of the related order. The following rules apply in top-down order:

Parameters:

status - status string matching one of the values for status