Order
Durable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle transitions.
Domain Role & Boundary
Order is the central Aggregate Root in the OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs bounded context, representing an accepted customer purchase with its locked purchase-time Order ItemEntityv1.0.0Order ItemChild entity within an Order capturing a purchased book identifier, positive quantity, and locked checkout-time unit pri...Ownercommerce-fulfillment-teamOpen docs lines and authoritative lifecycle status. Owned by Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs (with post-checkout saga coordination by Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs), it records what was bought and at what price. It explicitly does not own pre-purchase mutable baskets (ShoppingDomainv1.0.0ShoppingCoordinates the customer basket and pre-purchase checkout intent, from selecting books through handing an accepted purch...Ownercommerce-fulfillment-teamDiagramOpen docs), live catalog metadata (CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs), payment settlement, or email transport (PlatformDomainv1.0.0PlatformProvides cross-cutting capabilities for recurring scheduled triggers and durable, idempotent transactional email notific...Ownerplatform-engineering-teamDiagramOpen docs).
Entity Profile
| Property | Value |
|---|---|
| Bounded Context / Domain | OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs |
| Owning Service | Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs |
| DDD Role | Aggregate Root |
| Identifier Strategy | UUIDv7 generated at persistence |
| Persistence Store | Ordering relational database (orders) and event-sourced summary stream |
| Deletion Semantics | Soft-delete (isDeleted flag excludes deleted orders and items without altering status) |
| Concurrency Control | Optimistic concurrency via row version, paired with buyer-scoped distributed locks and idempotency keys |
| PII / Data Classification | Internal transactional record (note may contain customer-provided free text) |
Attributes & Constraints
| Name | Type | Required | Description | Reference |
|---|---|---|---|---|
| id | UUID | required | Globally unique UUIDv7 identifier for the order. | — |
| buyerId | UUID | optional | Identifier of the Buyer who placed the order (nullable if the buyer profile is later deleted). | buyerProperty: id |
| status | string NewCompletedCancelled | required | Authoritative business lifecycle status owned by Ordering. | — |
| note | string | optional | Optional customer delivery or order note (up to 500 characters). | — |
| orderItems | order-item[] | required | Purchase-time line items composing the order. | order-itemProperty: id |
| totalPrice | decimal | required | Computed sum of unit price multiplied by quantity across all order items. | — |
| isDeleted | boolean | required | Soft-delete marker independent of the order's business status. | — |
| createdAt | datetime | required | UTC timestamp when the order was placed. | — |
| lastModifiedAt | datetime | optional | UTC timestamp of the most recent modification. | — |
| rowVersion | string | required | Persistence-managed optimistic concurrency token. | — |
| Attribute | Business Rule / Constraint | Sensitivity / Notes |
|---|---|---|
buyerId | Links to BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs; becomes null if the buyer profile is hard-deleted so accepted orders remain intact. | Customer reference |
status | Starts as New; transitions once to Completed or Cancelled. | Authoritative lifecycle state |
note | Optional free-text customer note, max 500 characters. | May contain user-entered PII |
totalPrice | Computed dynamically as the sum of price * quantity across orderItems; not stored separately. | Derived monetary total |
isDeleted | Defaults to false; hides the order and its items from standard queries when true. | Independent of status |
Domain Invariants & Lifecycle
- Single terminal transition: Every new order begins in
New. OnlyNeworders may transition toCompletedorCancelled; repeated identical transitions are idempotent, while cross-transitions (Completed↔Cancelled) are rejected. - Price snapshot isolation: Line-item prices are locked from CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs at checkout time so future catalog price changes never alter accepted orders.
- Soft-delete vs. business status: Soft-deleting an order (for example, during failed basket-cleanup compensation) hides it from standard queries without changing its
status. - Saga separation: Post-checkout orchestration progress in Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket
cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs and email delivery in Notification APIServicev1.0.0Notification APIInternal background worker that consumes order commands from Kafka, renders
MJML email templates, and submits mail over ...SubscribesPlaceOrderCommand, CancelOrderCommand +1APIsAsyncAPIOwnerplatform-engineering-teamDiagramRepositoryOpen docs never directly mutate an order’s business
status.
If post-checkout basket cleanup fails after bounded retries, Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs issues a compensation command so Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs soft-deletes the order and suppresses confirmation emails.
Order Status Lifecycle
Loading graph...
Relationships & Associated Operations
| Category | Resource | Role / Interaction |
|---|---|---|
| Related Entities | BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs, Order ItemEntityv1.0.0Order ItemChild entity within an Order capturing a purchased book identifier, positive quantity, and locked checkout-time unit pri...Ownercommerce-fulfillment-teamOpen docs | Placed by a buyer; owns one or more purchase-time order items |
| Cross-Context References | BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs | Referenced indirectly via Order ItemEntityv1.0.0Order ItemChild entity within an Order capturing a purchased book identifier, positive quantity, and locked checkout-time unit pri...Ownercommerce-fulfillment-teamOpen docs bookId |
| Mutating Commands | Create orderCommandv1.0.0Create orderCreates an Order for the authenticated Buyer using the current basket and Catalog pricing.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Complete orderCommandv1.0.0Complete orderMarks an existing Order as Completed when its current status is New.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Cancel orderCommandv1.0.0Cancel orderMarks an existing Order as Cancelled when its current status is New.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Delete orderCommandv1.0.0Delete orderSoft-deletes an Order by its identifier without changing its business status.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Handle basket deletion failedCommandv1.0.0Handle basket deletion failedReports Finance's failed basket-cleanup outcome so Order API can soft-delete the affected Order. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Place, complete, cancel, or soft-delete/compensate an order |
| Read Queries | Get orderQueryv1.0.0Get orderReturns Order details, including the recorded item quantities and prices.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, List ordersQueryv1.0.0List ordersReturns Orders with pagination and optional status and Buyer filters.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Retrieve order details or filtered order history |
| Emitted Events | User checked outEventv1.0.0User checked outReports that an Order was placed and its checkout details are ready for Finance coordination. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Order completedEventv1.0.0Order completedReports that an Order transitioned from New to Completed. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Order cancelledEventv1.0.0Order cancelledReports that an Order transitioned from New to Cancelled. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Trigger post-checkout saga and lifecycle email notifications |