-
Notifications
You must be signed in to change notification settings - Fork 0
Order Lifecycle
Máté Károlyi edited this page Oct 6, 2025
·
2 revisions
This page describes the business flow of an Order aggregate in the OMS (Order Management System).
An order goes through multiple states during its lifecycle.
The transitions are controlled by domain rules and emitted as domain events.
- WAITING_FOR_PAYMENT → order is waiting for customer payment
- PAID_SUCCESSFULLY → payment confirmed, order is ready for processing
- PROCESSING → order is being prepared (e.g., picking & packing)
- SHIPPED → order left the warehouse and is on its way
- DELIVERED → customer received the order
- RETURNED → customer returned the order
- REFUNDED → refund processed for customer
- CANCELLED → order was cancelled
- PAYMENT_FAILED / PAYMENT_CANCELED → payment attempt unsuccessful
Each significant transition emits a domain event:
OrderCreatedOrderPaidOrderShippedOrderDeliveredOrderCanceledOrderReturnedOrderRefundedOrderPaymentFailedOrderPaymentCanceled
These events can trigger actions such as:
- Clearing the basket after order creation
- Sending system notifications (email/SMS)
- Initiating refunds
- Updating projections for queries