Domain: Order¶
The Order domain manages the complete lifecycle of a customer order, from initial creation through payment, fulfilment and delivery.
User Stories¶
-
Order — User Stories
PostNL shipment label creation and order confirmation user stories.
Features¶
-
Order Management
Order creation, status tracking, cancellation and the full order lifecycle.
-
Payment Process
Payment initiation, Pay.nl integration, webhooks and payment status flow.
-
POS & Physical Store
Physical store in Woerden: in-store features, POS integration and click-and-collect.
-
Noodkassa (Emergency POS)
Legacy web-based fallback POS for in-store use when the primary K3/NAV system is unavailable.
Responsibilities¶
- Creating an order from a confirmed cart.
- Storing order lines, pricing and applied discounts.
- Tracking payment status via order transactions.
- Managing fulfilment details (shipment, track & trace).
- Storing delivery and billing addresses at the time of order.
- Triggering downstream events (e.g. order confirmed, order shipped).
Entities¶
| Entity | Description |
|---|---|
Order |
The root order record. Contains status, timestamps, references to customer and addresses, and aggregated totals. |
OrderLine |
A single product variant ordered, with quantity, unit price and line total. |
OrderTransaction |
A payment record linked to the order. Tracks payment method, status and PayNL reference. |
OrderFulfilment |
The fulfilment record for the order. Contains the chosen fulfilment method, PostNL track & trace code and shipment label reference. |
OrderDiscount |
A discount or promotional code applied to the order, with type and value. |
OrderAddress |
A snapshot of the delivery or billing address at the time of order placement. |
Order Statuses¶
| Status | Description |
|---|---|
pending |
Order created, awaiting payment confirmation. |
confirmed |
Payment confirmed; order is ready for fulfilment. |
processing |
Order is being prepared for shipment. |
shipped |
Shipment label created; track & trace code issued. |
delivered |
Delivery confirmed by carrier. |
cancelled |
Order cancelled before or after payment. |
refunded |
Payment fully or partially refunded. |
Integrations¶
PayNL — Payment
Payment is processed via PayNL. An OrderTransaction is created when the customer initiates payment. PayNL sends a webhook to update the transaction and order status upon payment confirmation or failure.
PostNL — Shipment
When an order is ready to ship, the back office creates a PostNL shipment via the PostNL API. This generates a track & trace code and shipment label, stored in OrderFulfilment.
Microsoft Dynamics — ERP
Confirmed orders may be pushed to Microsoft Dynamics for stock deduction and financial processing.
Business Rules¶
- An order is created from a
Cartand inherits its items, prices and fulfilment method selection. - Address data is snapshotted into
OrderAddressat order creation; subsequent changes to the customer's address book do not affect the order. - An order must have exactly one
OrderFulfilmentrecord. - An order may have multiple
OrderTransactionrecords (e.g. partial payments, retries), but only one successful transaction determines the confirmed status. - Discounts applied at cart level are recorded as
OrderDiscountentries for auditability.