An Order has a defined lifecycle, each stage of which is represented by the
state attribute. Additionally, when the
state changes, an Event is created that represents that change. For example, when the
state changes from
order.fulfilled Event is created.
The following table lists the enumerated
state values and their associated events in the approximate order they might occur in the lifecycle:
(1) When the Order...
(2) the state transitions to...
(3) and an ... event is emitted.
charge is capturable, but the order requires further fraud review, and, as a result, is still not ready to fulfill
is fully cancelled
is completely fulfilled or partially fulfilled and the remaining items are cancelled
the order charge is complete
state values for a successful Order (i.e. the happy path) are
complete . As the Order moves from one
state to another, the event is recorded with a timestamp in the
stateTransitions hash table.
The following diagram shows the possible
state values and the actions and events associated with each throughout the Order lifecycle:
An order must also pass through a fraud review. When exactly that review occurs in the order lifecycle depends on the payment method used by the customer. The different stages of the review are represented by the
fraudState attribute, whose enumerated values are
passed. These various states also trigger their own corresponding Event.