The HardgoodFulfillerModificationHandler deals with the ModifyOrder and ModifyOrderNotifications messages received by the HardgoodFulfiller. The HardgoodFulfiller contains a ModificationHandler property, which is set by default to the HardgoodFulfillerModificationHandler. This class is similar to the OrderFulfillerModificationHandler.
To change the handling behavior of ModifyOrder and ModifyOrderNotification messages, extend the HardgoodFulfillerModificationHandler class and change the ModificationHandler property HardgoodFulfiller to point to the new class.
The default implementation deals with the following ModifyOrder modification:
Remove the shipping group from the order:
The fulfillers can remove shipping groups if they have not been shipped. Determining whether a shipping group has been shipped can be difficult because of the asynchronous nature of shipping items. Consulting the states may not be enough to determine if the group has been shipped. Core Commerce consults the state to make sure that it is not in a NO_PENDING_ACTION or REMOVED state. This is sufficient because in the default Core Commerce configuration, there is no integration with a real warehouse so shipment is indicated by changing a set of states in the order repository. Some vendors might decide to create business rules that limit the time in which cancellations can occur because it is difficult to determine the exact shipping time for a shipping group.
Ship the shipping group:
The
HardgoodFulfillercan be notified that a shipping group has shipped through aModifyOrdermessage (which is originally sent to theOrderFulfiller, then forwarded to theHardgoodFulfiller). TheHardgoodFulfillergets aGenericUpdatemodification through theModifyOrdermessage, checks the current state of the shipping group to ensure that it is PENDING_SHIPMENT. If everything is fine, it sets the state to NO_PENDING_ACTION and notifies the rest of the system of the change with aModifyOrderNotificationmessage.
It also handles the following ModifyOrderNotification modification:
Shipping group update:
A shipping group is re-processed when the method
processMultipleShippingGroupsinHardgoodFulfilleris called. This method is called when a modification of type SHIPPING_GROUP_UPDATE is received. TheHardgoodFulfillerdoes not listen on the topic over whichModifyOrderNotificationmessages are sent. Instead, theOrderFulfufillerlistens on that topic and forwards the appropriate messages directly to theHardgoodFulfillerusing the port in defined inOrderFulfillmentTools.fulfillerPortNameMap.

