Sequence Diagrams
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.
One UML sequence diagram per command use case on
Use Cases; the long
ConfirmSession is drawn in two parts (authorize, then place the order).
Participant names are the packages and ports the model designs, from the
Class Diagram:
httpandschedulerare the inbound adapters. As built (51e0379), two more,mcp(cmd/mcp) anda2a(cmd/a2a), serve theGetSessionread only (diagram 6).- The use case is in
internal/application/usecases. Clientsstands for the outbound REST adaptersshoppingcart,deliverypromiseandpricing;Paymentsforcustomerpayments.ACLisinternal/adapters/outbound/customerordering, the Anti-Corruption Layer and the only participant that knows the network's wire names.Postgresstands for the repository, the outbox and the idempotency store. They share one transaction throughUnitOfWork.Relay / Kafkais the outbox relay. It reads committedoutbox_eventsrows and publishesCheckoutCompletedtoretailnetwork.checkout.eventsand the six other events toretailnetwork.checkout.analytics.
Every save is conditional on the loaded version (optimistic concurrency).
No outbound call sits inside a database transaction: the use case commits
the state it acts from, calls out, then commits the outcome. Full CloudEvents
types are on Domain Events.
1. OpenSession (REST POST /checkout-sessions)
Derived from: model.yaml → contexts[checkout].aggregates[CheckoutSession].commands[OpenSession],
.invariants[ErrCartNotCheckoutReady], .sync_calls, .rest["POST /checkout-sessions"],
.publishes[CheckoutOpened], conventions.integration_rules.
Omitted: the 503 when Clients cannot answer (the shopper retries with the
same Idempotency-Key), the 422 on invalid input, and the case where an
offer is not QUOTED or expires within 2 minutes at this pre-check, which
fails as ErrOfferNotQuotable (422 offer-not-quotable, no session, no state
change; hotspot H3,
resolved, on EventStorming).
2. ConfirmSession, part 1: authorize (REST POST .../confirmations)
Derived from: model.yaml → contexts[checkout].aggregates[CheckoutSession]
(transitions, invariants), .sync_calls[AuthorizePayment],
.rest["POST /checkout-sessions/{sessionId}/confirmations"],
.publishes[CheckoutDeclined], .policies[ResolveStuckAuthorizations, RetryOwedVoids].
Omitted: the 404 for an unknown session, a version conflict retried once
and then 409 concurrent-update. A Payments timeout on authorize leaves
the session AUTHORIZING; ResolveStuckAuthorizations re-calls after 2
minutes with the same key (hotspot H4, resolved). The offer check is not
repeated here: it runs at open only. A mismatching total or currency returns
the session to DECLINED with voidOwed set (hotspot H5, resolved): the void
is attempted at once, RetryOwedVoids repeats it every minute, and a new
confirm is refused with 409 void-pending until it has succeeded. A second
authorize after a decline is a new attempt with its own key (hotspot H2,
resolved; authAttempt starts at 0).
3. ConfirmSession, part 2: place the order
Derived from: model.yaml → contexts[checkout].business_decisions,
.aggregates[CheckoutSession] (transitions, ErrPlacementInDoubt),
.sync_calls (PlaceOrder, VoidAuthorization),
.publishes (CheckoutCompleted, CheckoutRequoteRequired,
CheckoutFailed, CheckoutPlacementInDoubt),
.policies[RetryOwedVoids].
The stored request is PII-free and carries shipToAddressId, never an
address; the Idempotency-Key towards the network is the sessionId. The
REQUOTE_REQUIRED and FAILED states are recorded together with
voidOwed, in one transaction, before the void is attempted; a failing void
is retried every minute by RetryOwedVoids (hotspot H5, resolved). Omitted:
the mapping of the network's wire names, which happens inside ACL
(internal/adapters/outbound/customerordering; hotspot H8, resolved).
4. ResolveInDoubtPlacements (scheduler)
Derived from: model.yaml → contexts[checkout].policies[ResolveInDoubtPlacements],
.business_decisions, .aggregates[CheckoutSession].transitions,
.sync_calls.
The replay is safe because the body is byte for byte the stored one and the
key is the same: customer-ordering replays its first response. No shopper
waits on this path; the BFF polls GetSession. The timeline is ordered:
alert at 20 h, give up and void at 22 h, customer-payments' void of an
unbound authorization at 24 h as the backstop (hotspot H6, resolved); Void
is idempotent, so a race is harmless. Omitted: the backoff schedule, which the
model does not give.
5. ExpireSession (scheduler)
Derived from: model.yaml → contexts[checkout].policies[ExpireOnQuoteExpiry],
.aggregates[CheckoutSession].transitions[OPEN, EXPIRED] and
[DECLINED, EXPIRED], .publishes[CheckoutSessionExpired].
DECLINED sessions expire like OPEN ones (hotspot H1, resolved). A session that moves to
AUTHORIZING between the load and the call is rejected by the version check
and by the aggregate.
6. GetSession (REST, MCP or A2A)
Source: internal/application/usecases/queries.go,
internal/adapters/inbound/http/server.go, internal/adapters/inbound/mcp/tools.go,
internal/adapters/inbound/a2a/skills.go, cmd/mcp/main.go, cmd/a2a/main.go.
As built (51e0379): the model does not draw this read as a use case;
GetSession is one, in internal/application/usecases, and three inbound
adapters share it. The MCP tool (get_checkout_session, L1 inform, service
ADR 0005)
and the A2A skill (checkout_session_status, L1 inform, service
ADR 0007)
are read-only: no write use case is wired into cmd/mcp or cmd/a2a, so
neither can reach the outbox, Kafka or a sibling. The A2A agent answers one
message per request (a message-only agent; streaming: false on its card)
with a Data part carrying the session and a Text part carrying a one-line
summary. MCP is served on :8090 at /mcp, A2A on :8093 at / and /a2a
with the Agent Card at /.well-known/agent-card.json; there is no auth on
either. Omitted: the MCP initialize handshake and the A2A JSON-RPC envelope.
Not drawn
RecordAuthorization, RecordDecline, RecordPlacementInDoubt,
RecordPlaced, RecordRequoteRequired and RecordFailure are the steps
drawn inside diagrams 2 to 4; they have no entry point of their own. GetSession
(REST GET /checkout-sessions/{sessionId}, the MCP tool get_checkout_session,
the A2A skill checkout_session_status) is diagram 6: it reads the session
through its port and changes nothing.