Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Order States and Asynchronous Processing

Order States and Asynchronous Processing

The synchronous order processing phase generates asynchronous order events. These events trigger subsequent processing of the order by internal handlers (e.g. email) and external systems (e.g. fulfillment). See Asynchronous Event Messaging for more information on creating and consuming events.

Order States and Events

The diagram below shows the order STATES in the boxes and the [EVENTS] that are sent when transitioning to a new state.

The order states and events are defined in the OrderStatus and OrderEventType extensible enums. They are also document from a business user perspective in Appendix A of the Commerce Manager Users Guide.

Shipment States and Events

Shipment state transitions and events can be triggered by order state transitions, or conversely can initiate order state transitions.

Shipment states are defined in the OrderShipmentStatus extensible enum. The values are:

  • AWAITING_INVENTORY
  • INVENTORY_ASSIGNED
  • RELEASED
  • SHIPPED
  • ONHOLD
  • CANCELLED
  • FAILED_ORDER

Shipment events are defined in the OrderEventType extensible enum. The values are:

  • ORDER_SHIPMENT_CREATED
  • ORDER_SHIPMENT_SHIPPED
  • ORDER_SHIPMENT_RELEASE_FAILED

Asynchronous Order Processing

A common project requirement is to add asynchronous order review processing after the order has been committed. The simplest way to do this is:

  1. Override the reversibleActions Spring bean to remove initiateFulfilmentCheckoutAction and capturePaymentCheckoutAction from the list of synchronous checkout actions defned in checkout.xml.
  2. Create a new Camel route in the Integration Server to consume ORDER_CREATED events and initiate order review processing.
  3. If the order passes review, release the order and capture payments. This will generate an [ORDER_RELEASED] event and transition the order state to IN_PROGRESS.
  4. If the order fails review, cancel the order. This will generate an [ORDER_CANCELLED] event and transition the order state to CANCELLED.