Customer Ordering
customer-ordering is the Generic bounded context that turns a shopper's
cart into a customer order. It belongs to the retail network's commerce tier
(CloudEvents segment commerce, the Storefront side of the portfolio): it
obtains a delivery promise for every shipment group at checkout, records the
order with the shopper and ship-to address (synthetic PII held only here), shows
the order's status and tracking, and handles customer cancellation. Shoppers and
their saved addresses live here too.
Cart-to-order is commodity commerce, so the context is kept thin: the promise
that makes the network different is owned by delivery-promise, and the choice
of the building that ships is owned by order-sourcing
(Subdomain classification,
ADR 0001). The context is an
Open Host Service: REST plus a published CloudEvents language on
retailnetwork.customer-ordering.events.
:::info What runs on develop
Three binaries over one Postgres database: cmd/api (REST, the transactional
outbox relay and three Kafka consumers in one process), and the read-only
cmd/mcp (ADR 0005) and cmd/a2a
(ADR 0008). All run on real Postgres; the
API also on real Kafka and a real delivery-promise endpoint. There is no
in-memory mode. web/ is the customer_ordering_mfe console remote
(ADR 0006). A Helm chart,
charts/customer-ordering, packages them (mcp, a2a and frontend are
optional components, off by default).
:::
What the context owns
| Concept | Where it lives | Rule in one line |
|---|---|---|
| CustomerOrder (aggregate) | internal/domain/customerorder | Lines, one promise per shipment group, the ship-to, and the customer-facing status derived from the group states. Every line is in exactly one group; the promise destination matches the ship-to; status only moves forward. |
| Shopper (aggregate) | internal/domain/shopper | A registered, synthetic shopper with a unique lower-cased e-mail and at most 20 saved addresses. |
| ShipTo (value object) | internal/domain/shipto | The delivery address. Synthetic PII, served by one restricted route and never carried by an event; events carry only the destination postal prefix. |
| Order tracking (read model) | tables group_signals, tracking_packages, tracking_package_groups, assignment_links | Event-fed: promise signals, verdicts, packages, scans, exceptions and outcomes of every group. |
| Inbox, idempotency, outbox | tables processed_events, idempotency_keys, outbox_events | At-most-once consumption, replayed POSTs for 24 h, at-least-once publication. |
What it does NOT own
| Not here | Owner |
|---|---|
| Computing delivery dates, holding capacity, judging a promise kept or broken | delivery-promise (called synchronously at checkout; events consumed afterwards) |
| Choosing the shipping node, locking the assignment, accepting or refusing a cancel | order-sourcing |
| Labels, scans, deliveries, the package journey | shipping-and-tracking (the only reader of the ship-to address, for the label) |
| Carts, catalogue, prices, availability | the other Storefront contexts |
| Payments, refunds, returns after the lock | other contexts: customer-payments (storefront, built on its develop) and returns-processing (WMS, built on its develop) exist, but this context has no edge to either: no call, no consumed or published event type of theirs |
| Invoices, tax, notifications | no context found in the IQVO organisation, and none here |
| Authentication | nothing: REST, MCP and A2A are unauthenticated fleet-wide; the shopper's identity is only a shopperId in the request |
This context never calls order-sourcing or shipping-and-tracking. Its one
outbound call is to delivery-promise
(Integration).
Main capabilities
- Checkout (
POST /checkout): quote check, make and confirm a promise per group atdelivery-promise, then store the order and publishCustomerOrderPlacedin one transaction. A failed confirm places nothing and cancels the promises of the same checkout that were already confirmed. An expired offer answers 409 with fresh offers. - Order history and status:
GET /orders?shopperId=(newest first, keysetcursor, answered as{items, nextCursor}),GET /orders/{orderId},GET /orders/{orderId}/tracking. - Cancellation (
POST /orders/{orderId}/cancellations): a request to order-sourcing for every unlocked group; order-sourcing accepts or refuses. An unkeepable promise cancels its group by policy. - Ship-to:
GET /orders/{orderId}/ship-to, the one restricted route that returns the address (Cache-Control: no-store). - Shoppers and saved addresses: register, look up by id or e-mail, add up to
20 saved addresses; checkout may use
shipToAddressIdinstead of an inlineshipTo. - Read-only agent surfaces: three MCP tools and two A2A skills over the same read use cases (MCP tools, API overview).
- Events: publishes
CustomerOrderPlacedandCustomerOrderCancelled; consumes five delivery-promise, five order-sourcing and seven shipping-and-tracking events (Event catalogue).
Where to go next
| You want to | Read |
|---|---|
| See the layers, packages, binaries and the rules that police them | Architecture, Runtime |
| Run it and make the first calls | Quickstart |
| Know every setting | Configuration |
| Deploy and operate it | Runbook, Observability, Before the first release |
| Fix something that broke | Troubleshooting |
| Know what tests and CI gates exist | Testing |
| See who talks to whom | Integration |
| See the application use cases and their invariants | Use cases |
| Read the design in ddd-crew artifacts | DDD artifacts, Ubiquitous language |
| Read the contracts | API overview, Event catalogue, MCP tools |
| Read the decisions | ADR index |
Published at https://iqvo.github.io/customer-ordering/.
This project is a domain-driven design study. It is not associated with, endorsed by or affiliated with any company, and it uses no company's code, data, logos or trademarks. All names, figures and examples are illustrative or synthetic.