Script: Class dw.order.Return

Class Return

The Return represents a physical customer return, and contains 1..n ReturnItems. The Return is associated with one ReturnCase, and each ReturnItem is associated with one ReturnCaseItem and (via the ReturnCaseItem) a single OrderItem usually representing an Order ProductLineItem.
The ReturnItem records the quantity returned.
The Return can have one of these status values:

  • NEW - the return is new, i.e. needs to undergo a check before it can be marked as COMPLETED
  • COMPLETED - the return is complete, this is a precondition for refunding the customer for a return.

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

ORDERBY_ITEMID : Object

Sorting by item id. Use with method getItems() as an argument to method FilteringCollection.sort(Object).

ORDERBY_ITEMPOSITION : Object

Sorting by the position of the related oder item. Use with method getItems() as an argument to method FilteringCollection.sort(Object).

ORDERBY_UNSORTED : Object

Unsorted , as it is. Use with method getItems() as an argument to method FilteringCollection.sort(Object).

QUALIFIER_PRODUCTITEMS : Object

Selects the product items. Use with method getItems() as an argument to method FilteringCollection.select(Object).

QUALIFIER_SERVICEITEMS : Object

Selects for the service items. Use with method getItems() as an argument to method FilteringCollection.select(Object).

STATUS_COMPLETED : String = "COMPLETED"

Constant for Return Status COMPLETED

STATUS_NEW : String = "NEW"

Constant for Return Status NEW

Properties

invoice : Invoice Read Only

Returns null or the previously created Invoice.

invoiceNumber : String Read Only

Returns null or the invoice-number.

items : FilteringCollection Read Only

The ReturnItems contained in the Return, created with method createItem(String).

This FilteringCollection can be sorted / filtered using:

note : String

A note for the return.

returnCase : ReturnCase Read Only

The ReturnCase with which this Return is associated. The ReturnCase may represent an RMA (return merchandise authorization).

returnNumber : String Read Only

The return number identifying this return.

status : EnumValue

Gets the return status.

Possible values are STATUS_NEW, STATUS_COMPLETED.

Constructor Summary

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

Method Summary

createInvoice() : Invoice

Creates a new Invoice based on this Return.

createInvoice(invoiceNumber : String) : Invoice

Creates a new Invoice based on this Return.

createItem(returnCaseItemID : String) : ReturnItem

Create a ReturnItem based on a ReturnCaseItem.

getInvoice() : Invoice

Returns null or the previously created Invoice.

getInvoiceNumber() : String

Returns null or the invoice-number.

getItems() : FilteringCollection

Returns the ReturnItems contained in the Return, created with method createItem(String).

getNote() : String

A note for the return.

getReturnCase() : ReturnCase

Returns the ReturnCase with which this Return is associated.

getReturnNumber() : String

The return number identifying this return.

getStatus() : EnumValue

Gets the return status.

setNote(note : String) : void

Sets a note for the return.

setStatus(statusName : String) : void

Sets the return status.

Methods inherited from class AbstractItemCtnr

getCreatedBy, getCreationDate, getGrandTotal, getItems, getLastModified, getModifiedBy, getOrder, getProductSubtotal, getServiceSubtotal

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

createInvoice

createInvoice() : Invoice

Creates a new Invoice based on this Return. The return-number will be used as the invoice-number. The Invoice can then be accessed using getInvoice() or its number using getInvoiceNumber(). The method must not be called more than once for a Return, nor may 2 Invoices exist with the same invoice-number.

The new Invoice is a credit-invoice with a Invoice.STATUS_NOT_PAID status, and will be passed to the refund payment-hook in a separate database transaction for processing.

Returns:

new invoice

createInvoice

createInvoice(invoiceNumber : String) : Invoice

Creates a new Invoice based on this Return. The invoice-number must be specified as an argument. The Invoice can then be accessed using getInvoice() or its number using getInvoiceNumber(). The method must not be called more than once for a Return, nor may 2 Invoices exist with the same invoice-number.

The new Invoice is a credit-invoice with a Invoice.STATUS_NOT_PAID status, and will be passed to the refund payment-hook in a separate database transaction for processing.

Parameters:

invoiceNumber - the invoice-number to use

Returns:

the new invoice


createItem

createItem(returnCaseItemID : String) : ReturnItem

Create a ReturnItem based on a ReturnCaseItem.

Parameters:

returnCaseItemID - the id of the return case item

Returns:

the created return item


getInvoice

getInvoice() : Invoice

Returns null or the previously created Invoice.

Returns:

null or the previously created invoice.

See Also:

createInvoice(String)


getInvoiceNumber

getInvoiceNumber() : String

Returns null or the invoice-number.

Returns:

null or the previously created invoice.

See Also:

createInvoice(String)


getItems

getItems() : FilteringCollection

Returns the ReturnItems contained in the Return, created with method createItem(String).

This FilteringCollection can be sorted / filtered using:

Returns:

the return items

See Also:

ReturnItem


getNote

getNote() : String

A note for the return.

Returns:

the note or null


getReturnCase

getReturnCase() : ReturnCase

Returns the ReturnCase with which this Return is associated. The ReturnCase may represent an RMA (return merchandise authorization).

Returns:

the return case


getReturnNumber

getReturnNumber() : String

The return number identifying this return.

Returns:

the return number


getStatus

getStatus() : EnumValue

Gets the return status.

Possible values are STATUS_NEW, STATUS_COMPLETED.

Returns:

the status


setNote

setNote(note : String) : void

Sets a note for the return.

Parameters:

note - the note


setStatus

setStatus(statusName : String) : void

Sets the return status.

Possible values are STATUS_NEW, STATUS_COMPLETED

When set to status COMPLETED, only the the custom attributes of the return itself and its return items can be changed.

Parameters:

statusName - the status