Script: Class dw.order.Appeasement

Class Appeasement

The Appeasement represents a shopper request for an order credit.
Example: The buyer finds any problem with the products but he agrees to preserve them, if he would be compensated, rather than return them.

The Appeasement contains 1..n appeasement items. Each appeasement item is associated with one OrderItem usually representing an Order ProductLineItem.

An Appeasement can have one of these status values:

  • OPEN - the appeasement is open and appeasement items could be added to it
  • COMPLETED - the appeasement is complete and it is not allowed to add new items to it, this is a precondition for refunding the customer for an appeasement.

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 order 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 the service items. Use with method getItems() as an argument to method FilteringCollection.select(Object).

STATUS_COMPLETED : String = "COMPLETED"

Constant for Appeasement Status COMPLETED

STATUS_OPEN : String = "OPEN"

Constant for Appeasement Status OPEN

Properties

appeasementNumber : String Read Only

The appeasement number.

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

A filtering collection of the appeasement items belonging to the appeasement.

This FilteringCollection could be sorted / filtered using:

reasonCode : EnumValue

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

reasonNote : String

The reason note for the appeasement.

status : EnumValue

Gets the status of this appeasement.
The possible values are STATUS_OPEN, STATUS_COMPLETED.

Constructor Summary

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

Method Summary

addItems(totalAmount : Money, orderItems : List) : void

Creates appeasement items corresponding to certain order items and adds them to the appeasement.

createInvoice() : Invoice

Creates a new Invoice based on this Appeasement.

createInvoice(invoiceNumber : String) : Invoice

Creates a new Invoice based on this Appeasement.

getAppeasementNumber() : String

Returns the appeasement number.

getInvoice() : Invoice

Returns null or the previously created Invoice.

getInvoiceNumber() : String

Returns null or the invoice-number.

getItems() : FilteringCollection

Returns a filtering collection of the appeasement items belonging to the appeasement.

getReasonCode() : EnumValue

Returns the reason code for the appeasement.

getReasonNote() : String

Returns the reason note for the appeasement.

getStatus() : EnumValue

Gets the status of this appeasement.
The possible values are STATUS_OPEN, STATUS_COMPLETED.

setReasonCode(reasonCode : String) : void

Set the reason code for the appeasement.

setReasonNote(reasonNote : String) : void

Sets the reason note for the appeasement.

setStatus(appeasementStatus : String) : void

Sets the appeasement 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

addItems

addItems(totalAmount : Money, orderItems : List) : void

Creates appeasement items corresponding to certain order items and adds them to the appeasement.

Parameters:

totalAmount - the appeasement amount corresponding to the provided order items; this amount is the net price when the order is net based and respectively - gross price when the order is gross based

orderItems - the order items for which appeasement items should be created

createInvoice

createInvoice() : Invoice

Creates a new Invoice based on this Appeasement. The appeasement-number will be used as the invoice-number.

The method must not be called more than once for an Appeasement, 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 should be passed to the refund payment-hook in a separate database transaction for processing.

Returns:

the created invoice


createInvoice

createInvoice(invoiceNumber : String) : Invoice

Creates a new Invoice based on this Appeasement. The invoice-number must be specified as an argument.

The method must not be called more than once for an Appeasement, 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 should be passed to the refund payment-hook in a separate database transaction for processing.

Parameters:

invoiceNumber - the invoice-number to be used in the appeasement creation process

Returns:

the created invoice


getAppeasementNumber

getAppeasementNumber() : String

Returns the appeasement number.

Returns:

the appeasement number


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 number of the previously created invoice

See Also:

createInvoice(String)


getItems

getItems() : FilteringCollection

Returns a filtering collection of the appeasement items belonging to the appeasement.

This FilteringCollection could be sorted / filtered using:

Returns:

the filtering collection of the appeasement items


getReasonCode

getReasonCode() : EnumValue

Returns the reason code for the appeasement. The list of reason codes can be updated by updating meta-data for Appeasement.

Returns:

the appeasement reason code


getReasonNote

getReasonNote() : String

Returns the reason note for the appeasement.

Returns:

the reason note or null


getStatus

getStatus() : EnumValue

Gets the status of this appeasement.
The possible values are STATUS_OPEN, STATUS_COMPLETED.

Returns:

the status


setReasonCode

setReasonCode(reasonCode : String) : void

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

Parameters:

reasonCode - the reason code to set


setReasonNote

setReasonNote(reasonNote : String) : void

Sets the reason note for the appeasement.

Parameters:

reasonNote - the reason note for the appeasement to set


setStatus

setStatus(appeasementStatus : String) : void

Sets the appeasement status.

The possible values are STATUS_OPEN, STATUS_COMPLETED.

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

Parameters:

appeasementStatus - the appeasement status to set.