Orders
Staging an Order
Staging an order happens when the user chooses to complete the purchase on the items within the basket.
This process takes a priced basket and returns a StagedOrder
to capture a snapshot of the pricing that the user was presented with (on checkout).
The StagedOrder
is temporary and should only live for the duration of the the checkout process.
Placing an Order
Generally an order is placed after the payment has been received.
This will promote the StagedOrder
to a PlacedOrder
and remove the temporary StagedOrder
.
IOrderPlacedListener
The IOrderPlacedListener
interface allows implementations to process orders after they are placed and before they are confirmed.
Order Confirmation Email Listener
The OrderConfirmationEmailListener
is a builtin IOrderPlacedListener
that sends emails when an order is placed. This can be enabled using the SendEmailConfirmation
setting and the email content can be customised by modifying the order confirmed email template.
Confirming an Order
The confirmed status relates to the acceptance of the order (from 3rd party, vendor, other systems) i.e. someone else needs to know about this order, and until they do it's not confirmed.
IOrderConfirmationListener
The IOrderConfirmationListener
interface allows implementations to process orders after they are confirmed.
In Process / Out of Process
The IOrderPlacedListener
and IOrderConfirmationListener
can process tasks either in process or out of process i.e. complete the task while the user waits for the response or register the task need to be completed later for example, adding a item to a queue which then gets picked up by and out of process event handler which processes the task.
IOrderPlacedListener
's and IOrderConfirmationListener
's should follow the out or process pattern where possible and only use the in process pattern when there is a business requirement to do so.
Order Handlers
Order information can also be persisted in modules independently of the Order module. The Order headers, info, and lines can be persisted and loaded from separate modules using handlers.
- IOrderHeaderLoader
- IOrderInfoLoader
- IOrderLineLoader
These handlers are run when loading and persisting a PlacedOrder
in the OrderService
.
The order is still persisted using the JSON serializer by default.
Note: the handlers are not run for StagedOrders
so should not be used for any information related to the checkout flow.