Bounded Context Canvas
Derived from model/model.yaml. The checkout service is built on develop (IQVO/checkout at 51e0379, checked 2026-12-02), released at v0.1.4 and applied to the k3s cluster: the api and the A2A agent are deployed, the MCP server is registered in warehouse-infra and switched off. Every Err... name, REST route and CloudEvents type of this context named on this page exists in the service; where the built service differs from the model's design, the page says so (As built) or the context's Service and operations section lists it.
Following the ddd-crew Bounded Context Canvas v5.
Every message row comes from contexts[checkout] (inbound, consumes,
publishes, rest, sync_calls) or from a neighbour's entry that names
this context.
Canvas at a glance
Two pictures of the sections below, laid out like the ddd-crew canvas:
first the inbound collaborators feeding this context (purpose, domain roles
and the business decisions it enforces), then the outbound collaborators it
commands, queries and notifies. Arrows follow the message type: solid blue
commands (cmd), dotted green queries (qry), thick orange events
(evt); each arrow names its channel and the messages it carries. Box
shapes mark the collaborator kind: rounded = people, UI or any client;
blue = sibling bounded context; red = network context. Channel names on
the arrows are abbreviated; the Inbound and Outbound Communication tables
carry the exact route, topic and CloudEvents type for every message.
Inbound
Outbound
Derived from: model.yaml → contexts[checkout].inbound, .publishes,
.sync_calls, .purpose, .roles, .business_decisions.
The diagrams omit assumptions, verification metrics, open questions and the
ubiquitous language (sections below) and the relationship pattern per
message (see the tables). The model lists no consumed event for this context
(consumes: []): everything it learns it learns from a synchronous answer.
The AI clients collaborator is as built (cmd/mcp and cmd/a2a, service
ADRs 0005 and 0007): the model has no agent row, and the agent surface is the
GetSession read only.
Name
Checkout (checkout, code CK, CloudEvents tier storefront).
Purpose
To run the purchase saga. The context:
- opens a session from a cart: reads the cart snapshot, pre-checks (once, at
open) that every selected offer is still
QUOTEDand does not expire within 2 minutes, obtains the bindingPriceQuote, numbers the lines1..nand groups them by the quote'sgroupNo(gap S1); - on confirm authorizes the quote total with an allocation per group, then places the order through the Anti-Corruption Layer with the stored, PII-free request;
- settles the three definitive failures (decline, requote, contract bug) and the one unknown (in-doubt placement) with a defined state each;
- announces the outcome:
CheckoutCompletedfor the cart and for payments, four analytics events for the funnel.
Strategic Classification
| Axis | Verdict |
|---|---|
| Domain | Supporting subdomain. See the Core Domain Chart. |
| Business Model | Conversion (the purchase transaction). |
| Evolution | Custom-built. |
Domain Roles
| Role | Applies? | Evidence in the model |
|---|---|---|
| Execution (saga orchestration) | Yes, primary | The CheckoutSession aggregate: OpenSession through ExpireSession, one record of where the purchase stands, plus the two policies. |
| Enforcer (no two holds on a card for one session) | Yes | The deterministic Idempotency-Key <sessionId>:auth:<authAttempt> on AuthorizePayment, the PLACING semantic lock (ErrPlacementInDoubt) and customer-payments' one-authorization-per-session invariant. |
| Analysis | No | The cart's readiness is shopping-cart's fact; checkout only enforces it (ErrCartNotCheckoutReady). |
| Specification | No | Prices, charges and tax are pricing's specification. |
Inbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
Shopper via storefront-bff | OpenSession | Command | REST POST /checkout-sessions | UI |
Shopper via storefront-bff | ConfirmSession | Command | REST POST /checkout-sessions/{sessionId}/confirmations | UI |
Shopper via storefront-bff | GetSession | Query | REST GET /checkout-sessions/{sessionId}; the same read over MCP (as built) | UI |
| AI clients (agents; as built, not in the model) | GetSession | Query, the A2A delegation entry | MCP tool get_checkout_session at /api/mcp/checkout (switched off in warehouse-infra); A2A skill checkout_session_status at /api/a2a/checkout through the Agent Router (deployed) | Open Host Service, read-only, L1 inform |
Route-to-command note: the three routes map onto OpenSession,
ConfirmSession and GetSession. The other seven commands of the aggregate
(RecordAuthorization, RecordDecline, RecordPlacementInDoubt,
RecordPlaced, RecordRequoteRequired, RecordFailure, ExpireSession)
have no inbound route: they are the outcomes the saga records on itself, from
the answers of its outbound calls and from the two policies. As built, the
MCP tool get_checkout_session and the A2A skill checkout_session_status are
the same GetSession read, served by two read-only binaries (cmd/mcp,
cmd/a2a) over the use case the REST route uses; no agent surface opens or
confirms a session, because both move a shopper's money.
Outbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
shopping-cart | GetCart | Query | REST GET /carts/{cartId} | Customer/Supplier (we are the Customer) |
delivery-promise (network) | GetDeliveryOffer | Query | REST GET /delivery-offers/{offerId} (pre-check that every selected offer is still QUOTED, with margin) | Open Host Service; we are the Customer |
pricing | IssuePriceQuote | Command | REST POST /price-quotes | Customer/Supplier (we are the Customer) |
customer-payments | AuthorizePayment | Command | REST POST /payment-authorizations (Idempotency-Key <sessionId>:auth:<authAttempt>, allocations per group) | Customer/Supplier (we are the Customer) |
customer-payments | VoidAuthorization | Command | REST POST /payment-authorizations/{authorizationId}/voids (Idempotency-Key <sessionId>:void; only after a definitive rejection) | Customer/Supplier (we are the Customer) |
customer-ordering (network) | PlaceOrder | Command | REST POST /checkout through the ACL (internal/adapters/outbound/customerordering); Idempotency-Key is the sessionId; shipToAddressId (NG1), never an inline address | Open Host Service behind an Anti-Corruption Layer; we are the Customer |
shopping-cart, customer-payments | CheckoutCompleted | Event | Kafka retailnetwork.checkout.events, com.retailnetwork.storefront.checkout.checkoutsession.CheckoutCompleted | Customer/Supplier (we are the Supplier) |
| analytics only | CheckoutOpened | Event | Kafka retailnetwork.checkout.analytics, com.retailnetwork.storefront.checkout.checkoutsession.CheckoutOpened | analytics stream |
| analytics only | CheckoutDeclined | Event | Kafka retailnetwork.checkout.analytics, com.retailnetwork.storefront.checkout.checkoutsession.CheckoutDeclined | analytics stream |
| analytics only | CheckoutRequoteRequired | Event | Kafka retailnetwork.checkout.analytics, com.retailnetwork.storefront.checkout.checkoutsession.CheckoutRequoteRequired | analytics stream |
| analytics only | CheckoutFailed | Event | Kafka retailnetwork.checkout.analytics, com.retailnetwork.storefront.checkout.checkoutsession.CheckoutFailed | analytics stream |
What the neighbours do with them: the cart closes on CheckoutCompleted
(CloseOnCheckoutCompleted); customer-payments binds the order to the
session's authorization on it (BindOrderOnCheckoutCompleted) and applies any
parked fulfilment facts. Relationship evidence:
Context Map.
Ubiquitous Language
Full glossary: Ubiquitous Language. Top terms: Checkout Session, Place-Order Step (the network's "Checkout"), In-Doubt Placement, Requote, Allocation.
Business Decisions
- Money flow (D5). Authorize before placing the order; capture per
shipment group on
FulfillmentShipped; release onFulfillmentCancelled; refund onPackageLostorPackageReturned. - The network's "Checkout" is the place-order step, reached through an
Anti-Corruption Layer in
internal/adapters/outbound/customerordering, the only place that knows network wire names. - A decline keeps the session open for another token while the price
quote is valid; a definitive
409voids the authorization and asks for a requote; a422is a contract bug: void,FAILED, alert. - A
503or timeout leaves the sessionPLACING, answers202, andResolveInDoubtPlacementsreplays the stored body with the sameIdempotency-Keyuntil a definitive answer; alert at 20 h, before the network's 24 h idempotency window. - The cart must be ready, the quote unexpired.
ErrCartNotCheckoutReadyat open,ErrPriceQuoteExpired(422) at confirm, andExpireOnQuoteExpiryends an open or declined session with its quote. - The authorized amount equals the quote total
(
ErrAuthorizationMismatch): a mismatch returns the session toDECLINEDwith the void owed and answers409; a new confirm is refused with409 void-pendinguntil the void has succeeded. - A closed session never changes (
ErrSessionClosed):COMPLETED,EXPIRED,FAILEDandREQUOTE_REQUIREDallow no transition out. - No PII. The session holds
shopperIdandshipToAddressId; the stored placement request is PII-free.
Assumptions
- The BFF mints the
Idempotency-Keyfor every write and readsGET /checkout-sessions/{sessionId}to poll aPLACINGsession after a202(REST contract description). customer-orderingreplays the first response to a repeatedIdempotency-Key(the policyResolveInDoubtPlacementssays so), and the network's idempotency window is 24 h (decision text; see Open Questions).- The network exposes
shipToAddressIdonPOST /checkout(the EXTEND NG1), and its wire names (Checkout,offer-not-quotable,requotedOffers) stay inside the ACL. customer-paymentsreturns a decline as a definitive answer and a successful void as a definitive answer; the session records both.- Every write route is idempotent on
Idempotency-Key; every published event leaves through the transactional outbox. - One configured currency everywhere; the session records
currencyandtotalMinorfrom the quote, and anamountMinorper group.
Verification Metrics
| Metric | Target (proposed) | Source |
|---|---|---|
Sessions confirmed to COMPLETED over sessions confirmed | tracked; the conversion signal | CheckoutCompleted and CheckoutOpened counts |
Share of confirms ending DECLINED | tracked; alert on a spike | CheckoutDeclined |
Share of sessions ending REQUOTE_REQUIRED | low; a rise means offers expire between cart and confirm | CheckoutRequoteRequired |
FAILED sessions (contract bug) | 0; each one alerts | CheckoutFailed |
Sessions in PLACING and their age | 0 older than 20 h; alert at 20 h, before the network's 24 h window | checkout_sessions.state, updated_at |
Sessions with an authorization and no orderId after a definitive answer | 0 | authorizationId vs orderId |
| Authorization/void calls per session | one authorization key per attempt (<sessionId>:auth:<authAttempt>) | customer-payments metrics |
| Outbox age of the oldest unpublished checkout event | below 5 s | outbox_events.created_at |
Open Questions
- Where does
DECLINEDgo when the quote expires? The policyExpireOnQuoteExpirycovers anOPENorDECLINEDsession, but the transition list holds onlyOPEN → EXPIRED(hotspot H1 on EventStorming). - What key does the second authorize use? Resolved (hotspot H2):
AuthorizePaymentis keyed<sessionId>:auth:<authAttempt>;authAttemptstarts at 0 and grows on eachDECLINED → AUTHORIZING, so a retry with another token is a new attempt while a stuck call replays the same key. - What if the pre-check fails before authorizing? Resolved (hotspot H3):
offer-not-quotable(422) at open, no session and no state change. The check is not repeated at confirm; an offer that expires between open and confirm comes back fromcustomer-orderingas aPLACING-time409, the only way toREQUOTE_REQUIRED. - What ends
AUTHORIZINGif the authorize outcome is unknown? No transition leavesAUTHORIZINGfor a timeout;customer-paymentsonly voids unbound authorizations after 24 h (hotspot H4). - A failed void.
REQUOTE_REQUIREDandFAILEDfollow a successful void (REST contract); the model does not say what a failed void does (hotspot H5). - The resolver and the 24 h void race.
ResolveInDoubtPlacementsmay still be replaying near the 24 h mark at whichcustomer-paymentsvoids an authorization withoutCheckoutCompleted(hotspot H6). - Silent outcomes.
ExpireSessionandRecordPlacementInDoubtpublish nothing, so analytics cannot see expiry or in-doubt volume (hotspot H7). - The network contract (hotspot H8): resolved.
shipToAddressId,offer-not-quotableandrequotedOffersare now in the network model (customer-ordering) and in customer-ordering'sapis/openapi.yamlon develop (POST /checkout, 409offer-not-quotablewithrequotedOffers). - The stored placement request has no name. Its shape, its retention ("for the idempotency window") and its purge are unnamed (hotspot H9).
- How does the cart take the requoted offers? The REST contract says the
BFF writes them into the cart as a new quote, yet the cart's commands only
quote through
delivery-promise(QuoteDelivery); none accepts an offer set from outside (hotspot H10). The model now hasAcceptRequotedOffers, and as built shopping-cart servesPOST /carts/{cartId}/delivery-requote-acceptances(acceptRequotedOffers), butstorefront-bffexposes no route that calls it, so the requote path is not reachable from the web app yet.