The following examples demonstrate the behavior of the HardgoodFulfiller
in different situations.
Example 1: An order is received with one item that is IN_STOCK:
FulfillOrderFragment
received with one shipping group.The one item in the shipping group successfully allocates. The
ShippingGroupCommerceItemRelationship's
state is set to PENDING_DELIVERY.The state of the
ShippingGroup
is set to PENDING_SHIPMENT.The group ships. When the
HardgoodFulfiller
is notified, the shipping group is set to NO_PENDING_ACTION and the item is set to DELIVERED.
Example 2: HardgoodFulfiller.outOfStockIsError=false
and an order is received with one item that is OUT_OF_STOCK:
FulfillOrderFragment
received with one shipping group.The 1 item in the shipping group fails to allocate but is successfully backordered. The state of
ShippingGroupCommerceItemRelationship
is set to OUT_OF_STOCK. (This example also applies to BACK_ORDERED and PRE_ORDERED items.)Some time later, an
UpdateInventory
message is received notifying theHardgoodFulfiller
that the item has new inventory available. The item is reallocated.The state of the
ShippingGroup
is set to PENDING_SHIPMENT.The group ships. When the
HardgoodFulfiller
is notified, the shipping group is set to NO_PENDING_ACTION and the item is set to DELIVERED.
Example 3: HardgoodFulfiller.outOfStockIsError=true
and an order is received with one item that is OUT_OF_STOCK:
FulfillOrderFragment
received with one shipping group.The one item in the shipping group fails to allocate but is successfully backordered. The state of
ShippingGroupCommerceItemRelationship
is set to OUT_OF_STOCK.Since
outOfStockIsError
is true, the shipping group’s state gets set to PENDING_MERCHANT_ACTION.At this point, it is the responsibility of the Customer Service Representative to correct the problem.
Example 4: HardgoodFulfiller.allowPartialShipmentDefault=true
and HardgoodFulfiller.outOfStockIsError=false
and an order is received with one item that is out of stock and one item that is available.
FulfillOrderFragment
received with one shipping group containing two items.The first item in the shipping group fails is out of stock. The state of
ShippingGroupCommerceItemRelationship
is set to OUT_OF_STOCK.The second item in the shipping group successfully allocates. Its state is set to PENDING_DELIVERY.
Since
allowPartialShipment
is true, the shipping group is split into two shipping groups. The first contains the PENDING_DELIVERY item and its state is set to PENDING_SHIPMENT. The second shipping group contains the out of stock item and its state remains PROCESSING.The first shipping group continues similarly to the fourth step in example 1. The second shipping group continues similarly to the third step in example 2.
Example 5: An order is received with one item that has no information in the inventory system.
FulfillOrderFragment
received with one shipping group.The one item in the shipping group is not found. The state of
ShippingGroupCommerceItemRelationship
is set to ITEM_NOT_FOUND.The state of
ShippingGroup
is set to PENDING_MERCHANT_ACTION.
Example 6: An order contains a shipping group in a state of PENDING_MERCHANT_ACTION. HardgoodFulfiller.shippingGroupHasShipped
is called with this shipping group.
An error is logged stating that a shipping group that was not in a PENDING_SHIPMENT state cannot be shipped.
shippingGroupHasShipped
returns false.
Example 7: An order contains a shipping group in a state of PENDING_SHIPMENT. A ModifyOrder
message with a GenericRemove
Modification on the order is received by the OrderFulfiller
.
The
OrderFulfiller
sets the order to PENDING_REMOVE.The
OrderFulfiller
sends aModifyOrder
message with aGenericRemove
modification for each shipping group in the order to the fulfiller.The fulfiller receives the
ModifyOrder
.The state of the
ShippingGroup
is set to PENDING_REMOVE.Each of the items in the shipping group has its state set to PENDING_REMOVE.
If the item was PENDING_DELIVERY, the stock level in the inventory is increased.
If the item was BACK_ORDERED, the backorder level in the inventory is increased.
If the item was PRE_ORDERED, the preorder level in the inventory is increased.
A
ModifyOrderNotification
is sent with each of the updates.This message is received by the
HardgoodFulfiller
. TheHardgoodFulfiller
sets the state of each object to REMOVED.HardgoodFulfiller
sends aModifyOrderNotification
with these updates.OrderFulfiller
receives theModifyOrderNotification
, when all shipping groups are REMOVED,OrderFulfiller
sets the order and eachCommerceItem
to REMOVED.
Example 8: An order contains a shipping group in a state of NO_PENDING_ACTION. A ModifyOrder
message with a GenericRemove
Modification on the order is received by the OrderFulfiller
.
The
OrderFulfiller
sets the order to PENDING_REMOVE.The
OrderFulfiller
sends aModifyOrder
message with aGenericRemove
modification for each shipping group in the order to the fulfiller.The fulfiller receives the
ModifyOrder
.The shipping group cannot be removed since it has already shipped.
A
ModifyOrderNotification
is sent with the originalGenericRemove
message set to a status of STATUS_FAILED.This message is received by the
OrderFulfiller
. TheOrderFulfiller
sets the state of the order to PENDING_MERCHANT_ACTION.