Domain Message Flow
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 ddd-crew Domain Message Flow Modelling.
Six scenarios. Participants are contexts and actors. Every arrow is a
message from the model, prefixed cmd: (command), qry: (query) or evt:
(event). A Note names a command the session runs on itself. Kafka is drawn
as one participant. Event names are written entity.EventName; the full
type is com.retailnetwork.<tier>.<producer>.<entity>.<EventName> (see
Domain Events). REST path
parameters are written without braces. The storefront-wide flows follow from
the Context Map.
1. A shopper opens a session from a ready cart
Derived from: model.yaml → contexts[checkout].inbound (BFF rows),
.aggregates[CheckoutSession].commands + .invariants, .sync_calls
(GetCart, GetDeliveryOffer, IssuePriceQuote),
.publishes[CheckoutOpened]; contexts[pricing].inbound;
network/model/model.yaml → contexts[delivery-promise].inbound (caller
shopper / storefront, GetDeliveryOffer).
Omitted: the outbox write and relay (see
Sequence Diagrams); the
503 the REST contract names when one of the three dependencies is
unreachable (the shopper retries with the same Idempotency-Key); and the
case where an offer is not QUOTED, or expires within 2 minutes, at this
pre-check: ErrOfferNotQuotable, 422 offer-not-quotable, no session and no
state change (hotspot H3, resolved, on
EventStorming). The check runs
at open only; confirm does not repeat it.
2. Confirm: authorize, place the order, complete
Derived from: model.yaml → contexts[checkout].aggregates[CheckoutSession]
(transitions, invariants, commands), .sync_calls (AuthorizePayment,
PlaceOrder), .publishes[CheckoutCompleted];
contexts[customer-payments].policies[BindOrderOnCheckoutCompleted] and
contexts[shopping-cart].policies[CloseOnCheckoutCompleted];
network/model/model.yaml → contexts[customer-ordering].inbound
(PlaceOrder).
The two consumers react independently; neither blocks the answer to the
shopper. Omitted: the transactional outbox, the replies' status codes on the
two network and payment calls beyond the success path, and the parked
fulfilment facts customer-payments applies after the bind (gap S4).
3. A decline, then another token
Derived from: model.yaml → contexts[checkout].business_decisions (a
decline keeps the session open), .aggregates[CheckoutSession].transitions
(RecordDecline, DECLINED → AUTHORIZING), .publishes[CheckoutDeclined];
contexts[customer-payments].publishes[PaymentDeclined].
A decline voids nothing, because no authorization exists. The quote is the
clock: the session stays open for as long as the binding price quote is valid,
and ExpireOnQuoteExpiry ends it afterwards (DECLINED → EXPIRED, hotspot
H1, resolved). The second AuthorizePayment is a new attempt: authAttempt
(which starts at 0) is incremented on DECLINED → AUTHORIZING, so the key
<sessionId>:auth:<authAttempt> differs and the first, declined answer is not
replayed (hotspot H2, resolved).
4. A late requote, or a contract failure
Derived from: model.yaml → contexts[checkout].business_decisions (a
definitive 409 voids and asks for a requote, a 422 is a contract bug),
.aggregates[CheckoutSession].transitions (RecordRequoteRequired,
RecordFailure), .sync_calls (VoidAuthorization: "only after a definitive
rejection"), .publishes[CheckoutRequoteRequired, CheckoutFailed], and the
Requote term; contexts[customer-payments].inbound (VoidAuthorization).
The void is why REQUOTE_REQUIRED and FAILED can be recorded: both follow a
successful void (REST contract description). What the session does when the
void itself fails is not in the model (hotspot H5). The shopper starts the
next attempt from the cart, with a new session. The REST contract says the BFF
writes the requoted offers into the cart as a new quote; the cart's
AcceptRequotedOffers (POST /carts/{cartId}/delivery-requote-acceptances, hotspot H10)
takes them, though storefront-bff has no route for it yet. Omitted:
the network's wire shapes (offer-not-quotable, requotedOffers), which are
the ACL's concern; they are in the network model and customer-ordering's
contract on develop (hotspot H8, resolved).
5. An in-doubt placement, resolved by replay
Derived from: model.yaml → contexts[checkout].business_decisions (a 503 or
timeout leaves the session PLACING, answers 202, and the resolver replays),
.policies[ResolveInDoubtPlacements],
.aggregates[CheckoutSession].invariants (ErrPlacementInDoubt),
.inbound (GetSession), .rest.
The replay is safe because the stored request is PII-free and byte for byte
the same, and customer-ordering replays its first response to a repeated
Idempotency-Key. A replay can end any of the three definitive ways: the
diagram shows the success; a 409 or 422 on the replay takes scenario 4
from the void on. If the network is still unreachable the session stays
PLACING, and the alert at 20 h comes before the network's 24 h window.
Omitted: the BFF's polling cadence, which the model does not define; and the
interplay with customer-payments' VoidUnboundAuthorizations, which voids an
authorization with no CheckoutCompleted after 24 h (hotspot H6).
6. An agent asks where a checkout session stands (MCP / A2A)
Derived from: as built (51e0379), not from the model:
internal/adapters/inbound/mcp/tools.go (get_checkout_session, L1 inform),
internal/adapters/inbound/a2a/skills.go (checkout_session_status, L1
inform), internal/application/usecases/queries.go (GetSession), service
ADR 0005
and ADR 0007.
The agent surface is this one read: an agent asks where a session stands and
gets the same session the BFF polls, through the Agent Router
(/api/mcp/checkout, switched off in warehouse-infra; /api/a2a/checkout,
deployed). A2A is delegation only: no fact travels over it, and the agent never
opens or confirms a session. Omitted: the REST route, which the BFF uses in
scenarios 2 and 5, and the transports' own handshakes.