Proposed Order Flow
Overview
The sequence diagram in this document represents the proposed Order Flow after the transformation from the as-is to the cleaned up version, available to review in the previous two documents:
The main change is the replacement of Hybris with CommerceLayer as our eCommerce solution with the particularity that CommerceLayer doesn't provide (for a good reason) the flexibility of customising any steps of the order process flow.
This means that CommerceLayer steps away from the complexity of providing a tool to differ from the expected Order Process, keeping it as simple as possible, but covering all the required statuses. It actually contemplates statuses for the Order itself, its Payment and Fulfilment.
Ideally, we should avoid the heavy customisation and patching we've done on the Order Process over the last ten years. We should challenge ourselves, questioning any customisation before adding extra complexity to it.
The other major change is to receive fulfilment notifications from the existing integration with GXO (already built on our MW) , rather than NAV. This way we avoid having a middle-service resending events we are capturing in the MW layer, where we can add a new subscriber without impacting the existing systems involved.
GXO current integration
As mentioned, GXO is currently integrated with NAV via our MW by the transaction event bus, receiving events of order statuses & shipments. We can add a new CommerceLayer subscriber to receive the changes and modifying its status accordingly, as per our requirements.
| Status | Shipment |
|---|---|
CommerceLayer Order Flow
CommerceLayer team shared with us an internal diagram where we can see the transitions between statuses on their end.
We can then use the existing webhooks on their end to perform the tasks required in our case, at least on Order level, see Realtime Webhooks documentation
| Event | Detail |
|---|---|
| orders.create | A new order is created |
| orders.pay | An existing order payment status is set to paid |
| orders.start_fulfilling | An existing order fulfillment status is set to in_progress |
| ... | ... |
Please notice that the current webhooks doesn't include Payment & Fulfiment status changes, but keeping them at Order level only. I've raised a question with the CL team to review if there will be this level of granularity in the future or not.
Order Process Flow
We will split the order in blocks to simplify the sequence representation
Checkout
TODO :
- Document the /quote calls to Avalara to calculate taxes.
- Confirm basket logic required - see Avalara Sales Tax / VAT / GST calculation logic
- Confirm DDU / DDP
Order process - Creation of an order
Order process running prior sending to NAV.
Fulfilment process
As mentioned, This would use the existing integration between GXO and NAV. The details of the payloads are documented here:
Order Process - post-shipped processing
Regarding Tax Filing, CommerceLayer team shared with us the following:
About tax filing it is possible to enable a flag on the avalara tax calculator (
commit_invoice) so that CL is going to send directly the transactions on Avalara. Then there are two ways to use it:
- Setup tax categories per SKU on Commerce Layer, configuring Avalara with their help
- Setup directly all SKU rules on Avalara
If you are going to follow the first way, consider that you need to import tax categories on Commerce Layer only if you need exceptions in comparison to the tax rate of the country, otherwise it is not needed.
Invoice commit on Avalara is going to happen when there is a capture of the payment and the payment status of the order is paid. A similar communication will happen on refund
Resources
- Avalara/Avatax process diagram - Rapha Confluence
- Avalara Sales Tax / VAT / GST calculation logic - Rapha Confluence
- Order Management - CommerceLayer
- Adyen Payments - CommerceLayer
- Tax Calculation - CommerceLayer
- Avalara Tax Calculator Object - CommerceLayer
- Realtime Webhooks - CommerceLayer
- The Order Pipeline - CommerceLayer
- GXO-NAV Integration Diagrams - Rapha Gitlab
- GXO-NAV Integration Messages