Related state transitions
This section explains related state transitions.
In Litium, the complexity of state transtions in an order is broken down into several state machines. For example, at the minimum, an order will have its set of
- order states
- payment states
- delivery states.
However, all of these states are related to each other. For example, an order cannot be "complete" if not all of its deliveries are "delivered". In the same way, if the order payment "fails", the order has to be in a state of "attention" to notify the administrators that the order requires some action.
The above scenarios are achieved through related state transitions. For the implemented virtual state machines, the final step of a state transtion is to examine the related state transitions and invoke them. A related state transition starts a new state transition cycle, but in a different state machine. For example, the payment state machine may invoke a related state transition in the order state machine.
The default state transition plugin implementation is configured in the following way to handle related state transitions:
- The order is set to Confirmed and then to Processing if the payment status is not Init or any delivery status is not Init.
- The order is set to Attention if a payment fails or if a delivery fails.
- The order is set to Completed if all payments are Paid and all deliveries are Delivered.