Class ShippingOrder
A shipping order is used to specify items that should be shipped, and is typically exported to, and updated by a back-office warehouse management system.
An Order can have n shipping orders expressing how the order is to be shipped. The creation, export and update of shipping orders is largely handled by custom logic in scripts by implementing ShippingOrderHooks. Use method Order.createShippingOrder() for creation and add items using createShippingOrderItem(OrderItem, Quantity) - each item is related to an order item which in turn represents a product- or shipping- line item in the order.
A shipping order has a status calculated from its item status, one of
- CONFIRMED - shipping order not yet exported, with 0 items, or all items in status CONFIRMED.
- WAREHOUSE - shipping order exported, with all items in status WAREHOUSE.
- SHIPPED - exported shipping order has been updated, with 1-n items in status SHIPPED and 0-n CANCELLED.
- CANCELLED - exported shipping order has been updated, with all items in status CANCELLED.
The following status transitions are supported. Every status transition is documented by the addition of an order note such as 'Shipping order 123456 status changed to WAREHOUSE.':
| From | To | When | Use |
|---|---|---|---|
| CONFIRMED | WAREHOUSE | Shipping order exported | Call setStatusWarehouse() - note this is the only way to set the items to status WAREHOUSE |
| WAREHOUSE | SHIPPED | One or more items have been SHIPPED | Call ShippingOrderItem.setStatus(String) using ShippingOrderItem.STATUS_SHIPPED |
| WAREHOUSE | CANCELLED | All items have been CANCELLED | Call ShippingOrderItem.setStatus(String) using ShippingOrderItem.STATUS_CANCELLED |
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.
| Constant | Description |
|---|---|
| ORDERBY_ITEMID: Object | Sorting by item id. |
| ORDERBY_ITEMPOSITION: Object | Sorting by the position of the related oder item. |
| ORDERBY_UNSORTED: Object | Unsorted , as it is. |
| QUALIFIER_PRODUCTITEMS: Object | Selects the product items. |
| QUALIFIER_SERVICEITEMS: Object | Selects for the service items. |
| STATUS_CANCELLED: String = "CANCELLED" | Constant for Shipping Order Status CANCELLED |
| STATUS_CONFIRMED: String = "CONFIRMED" | Constant for Shipping Order Status CONFIRMED |
| STATUS_SHIPPED: String = "SHIPPED" | Constant for Shipping Order Status SHIPPED |
| STATUS_WAREHOUSE: String = "WAREHOUSE" | Constant for Shipping Order Status WAREHOUSE |
| Property | Description |
|---|---|
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 shipping order items belonging to the shipping order. |
| shipDate: Date | Gets the shipping date. |
| shippingAddress: OrderAddress | Returns the shipping address (optional, can be null). |
shippingMethod: ShippingMethod (read-only) | Returns the shipping method of the shipping order. |
shippingOrderNumber: String (read-only) | Gets the shipping order number. |
status: EnumValue (read-only) | Gets the status of this shipping order. |
trackingInfos: Collection (read-only) | Gets all tracking informations for this shipping order. |
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| addTrackingInfo(String) | Adds a tracking info to this shipping order with the given ID. |
| createInvoice() | Creates a new Invoice based on this ShippingOrder. |
| createInvoice(String) | Creates a new Invoice based on this ShippingOrder. |
| createShippingOrderItem(OrderItem, Quantity) | Create a ShippingOrderItem in the shipping order with the number shippingOrderNumber. |
| createShippingOrderItem(OrderItem, Quantity, Boolean) | Create a ShippingOrderItem in the shipping order with the number shippingOrderNumber. |
| getInvoice() | Returns null or the previously created Invoice. |
| getInvoiceNumber() | Returns null or the invoice-number. |
| getItems() | A filtering collection of the shipping order items belonging to the shipping order. |
| getShipDate() | Gets the shipping date. |
| getShippingAddress() | Returns the shipping address (optional, can be null). |
| getShippingMethod() | Returns the shipping method of the shipping order. |
| getShippingOrderNumber() | Gets the shipping order number. |
| getStatus() | Gets the status of this shipping order. |
| getTrackingInfo(String) | Gets a tracking info for this shipping order. |
| getTrackingInfos() | Gets all tracking informations for this shipping order. |
| setShipDate(Date) | Sets the shipping date. |
| setShippingAddress(OrderAddress) | Set a shipping address for the shipping order. |
| setShippingMethodID(String) | Set the id of shipping method. |
| setStatusWarehouse() | Set a CONFIRMED shipping order (all items in status CONFIRMED) to status WAREHOUSE (all items in status WAREHOUSE). Note - this method is the only way to transition a shipping order from CONFIRMED to WAREHOUSE. |
getCreatedBy, getCreationDate, getGrandTotal, getItems, getLastModified, getModifiedBy, getOrder, getProductSubtotal, getServiceSubtotal
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
- 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_CANCELLED: String = "CANCELLED"
Constant for Shipping Order Status CANCELLED
- STATUS_CONFIRMED: String = "CONFIRMED"
Constant for Shipping Order Status CONFIRMED
- STATUS_SHIPPED: String = "SHIPPED"
Constant for Shipping Order Status SHIPPED
- STATUS_WAREHOUSE: String = "WAREHOUSE"
Constant for Shipping Order Status WAREHOUSE
- invoiceNumber: String
(read-only) Returns
nullor the invoice-number.See Also:
- items: FilteringCollection
(read-only) A filtering collection of the shipping order items belonging to the shipping order.
This FilteringCollection could be sorted / filtered using:
- FilteringCollection.sort(Object)with ORDERBY_ITEMID - FilteringCollection.sort(Object)with ORDERBY_ITEMPOSITION - FilteringCollection.sort(Object)with ORDERBY_UNSORTED - FilteringCollection.select(Object)with QUALIFIER_PRODUCTITEMS - FilteringCollection.select(Object)with QUALIFIER_SERVICEITEMS
See Also:
- shipDate: Date
Gets the shipping date.
Returns
nullif this shipping order is not yet shipped.
- shippingAddress: OrderAddress
Returns the shipping address (optional, can be null).
Note: the shipping address is not copied into the ShippingOrder but is a link to a OrderAddress held in the Order.
- shippingMethod: ShippingMethod
(read-only) Returns the shipping method of the shipping order.
Can be
null.
- shippingOrderNumber: String
(read-only) Gets the shipping order number.
- status: EnumValue
(read-only) Gets the status of this shipping order. The status is read-only and calculated from the item status. See class documentation for more details.
The possible values are STATUS_CONFIRMED, STATUS_WAREHOUSE, STATUS_SHIPPED, STATUS_CANCELLED.
- trackingInfos: Collection
(read-only) Gets all tracking informations for this shipping order.
See Also:
- addTrackingInfo(trackingInfoID: String): TrackingInfo
Adds a tracking info to this shipping order with the given ID.
Parameters:
- trackingInfoID - the tracking info id
Returns:
- the new tracking info
See Also:
- createInvoice(): Invoice
Creates a new Invoice based on this ShippingOrder.
The shipping-order-number will be used as the invoice-number. The Invoice can then be accessed using getInvoice() or getInvoiceNumber() can be used. The method must not be called more than once for a ShippingOrder, nor may 2 Invoices exist with the same invoice-number.
The new Invoice is a debit-invoice with a status Invoice.STATUS_NOT_PAID, and will be passed to the capture payment-hook in a separate database transaction for processing.
Returns:
- new invoice
- createInvoice(invoiceNumber: String): Invoice
Creates a new Invoice based on this ShippingOrder.
The invoice-number must be specified as an argument.The Invoice can then be accessed using getInvoice() or getInvoiceNumber() can be used. The method must not be called more than once for a ShippingOrder, nor may 2 Invoices exist with the same invoice-number.
The new Invoice is a debit-invoice with a status Invoice.STATUS_NOT_PAID, and will be passed to the capture payment-hook in a separate database transaction for processing.
Parameters:
- invoiceNumber - the invoice-number to use
Returns:
- new invoice
- createShippingOrderItem(orderItem: OrderItem, quantity: Quantity): ShippingOrderItem
Create a ShippingOrderItem in the shipping order with the number
shippingOrderNumber.The quantity of the new item can be optionally specified. A quantity of
nullindicates the new item should be based on the entire order item and is recommended for ShippingLineItems. If a quantity is specified for a ProductLineItem which is less than ProductLineItem.getQuantity() the ProductLineItem will be split, creating a new ProductLineItem. The new ShippingOrderItem will be associated with the new ProductLineItem, which will receive the specified quantity. See also createShippingOrderItem(OrderItem, Quantity, Boolean).Parameters:
- quantity - the quantity for which the shipping order item will be created
- orderItem - the order item for which the shipping order item is to be created
Returns:
- the created shipping order item
- createShippingOrderItem(orderItem: OrderItem, quantity: Quantity, splitIfPartial: Boolean): ShippingOrderItem
Create a ShippingOrderItem in the shipping order with the number
shippingOrderNumber.The quantity of the new item can be optionally specified. A quantity of
nullindicates the new item should be based on the entire order item and is recommended for ShippingLineItems. If the specified quantity is less than ProductLineItem.getQuantity() the ProductLineItem will be split or not depending onsplitIfPartialparameter. Whensplitistrue, the method is equivalent to createShippingOrderItem(OrderItem, Quantity).Parameters:
- quantity - the quantity for which the shipping order item will be created, not null
- orderItem - the order item for which the shipping order item is to be created
- splitIfPartial - the flag whether ProductLineItem should be split when requested quantity is less than ProductLineItem's quantity
Returns:
- the created shipping order item
- getInvoice(): Invoice
Returns null or the previously created Invoice.
Returns:
- null or the previously created invoice.
See Also:
- getInvoiceNumber(): String
Returns
nullor the invoice-number.Returns:
nullor the previously created invoice number.
See Also:
- getItems(): FilteringCollection
A filtering collection of the shipping order items belonging to the shipping order.
This FilteringCollection could be sorted / filtered using:
- FilteringCollection.sort(Object)with ORDERBY_ITEMID - FilteringCollection.sort(Object)with ORDERBY_ITEMPOSITION - FilteringCollection.sort(Object)with ORDERBY_UNSORTED - FilteringCollection.select(Object)with QUALIFIER_PRODUCTITEMS - FilteringCollection.select(Object)with QUALIFIER_SERVICEITEMS
Returns:
- the filtering collection of the shipping items.
See Also:
- getShipDate(): Date
Gets the shipping date.
Returns
nullif this shipping order is not yet shipped.Returns:
- the shipping date or
null
- the shipping date or
- getShippingAddress(): OrderAddress
Returns the shipping address (optional, can be null).
Note: the shipping address is not copied into the ShippingOrder but is a link to a OrderAddress held in the Order.
Returns:
- the shipping address or
null
- the shipping address or
- getShippingMethod(): ShippingMethod
Returns the shipping method of the shipping order.
Can be
null.Returns:
- the shipping method or
null
- the shipping method or
- getShippingOrderNumber(): String
Gets the shipping order number.
Returns:
- the shipping order number
- getStatus(): EnumValue
Gets the status of this shipping order. The status is read-only and calculated from the item status. See class documentation for more details.
The possible values are STATUS_CONFIRMED, STATUS_WAREHOUSE, STATUS_SHIPPED, STATUS_CANCELLED.
Returns:
- the status
- getTrackingInfo(trackingInfoID: String): TrackingInfo
Gets a tracking info for this shipping order.
Parameters:
- trackingInfoID - the tracking info id
Returns:
- the tracking info or
null
See Also:
- getTrackingInfos(): Collection
Gets all tracking informations for this shipping order.
Returns:
- all tracking informations for this shipping order
See Also:
- setShipDate(date: Date): void
Sets the shipping date.
Parameters:
- date - the ship date
- setShippingAddress(address: OrderAddress): void
Set a shipping address for the shipping order.
Parameters:
- address - the shipping address
See Also:
- setShippingMethodID(shippingMethodID: String): void
Set the id of shipping method.
Parameters:
- shippingMethodID - the id of the shipping method
See Also:
- setStatusWarehouse(): void
Set a CONFIRMED shipping order (all items in status CONFIRMED) to status WAREHOUSE (all items in status WAREHOUSE).
Note - this method is the only way to transition a shipping order from CONFIRMED to WAREHOUSE.
Throws:
- IllegalArgumentException - if the shipping order is in a status other than CONFIRMED.