Class Diagram
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.
UML class diagrams of the internal/domain/** packages as the model designs them, plus
the hexagonal ports and adapters. Type names come from the model's code
identifiers (checkoutsession.CheckoutSession, ports.OrderPlacer,
checkoutsession.CheckoutSession.RecordPlacementInDoubt, checkoutsession.RequotedOffer,
checkoutsession.Group.AmountMinor) and value objects. Fields are unexported in Go
and shown with -; methods are shown with +.
As built (IQVO/checkout develop 51e0379): the domain packages are internal/domain/checkoutsession. Exported types per package: checkoutsession: CheckoutSession, CheckoutOpened, CheckoutDeclined, CheckoutPlacementInDoubt, CheckoutCompleted, CheckoutRequoteRequired, CheckoutFailed, CheckoutSessionExpired, CartLine, CartGroup, CartSnapshot, OfferStatus, QuoteLine, QuoteCharge, PriceQuote, OpenInput, Snapshot, ID, State, Tier, Line, Group, RequotedOffer, StoredPlacement, VoidOwed. Application packages: internal/application/exchange, internal/application/idempotency, internal/application/outbox, internal/application/ports, internal/application/usecases, internal/application/views; adapters: internal/adapters/inbound/a2a, internal/adapters/inbound/http, internal/adapters/inbound/mcp, internal/adapters/inbound/requestlog, internal/adapters/inbound/scheduler, internal/adapters/outbound/alerts, internal/adapters/outbound/clock, internal/adapters/outbound/customerordering, internal/adapters/outbound/customerpayments, internal/adapters/outbound/deliverypromise, internal/adapters/outbound/httpx, internal/adapters/outbound/ids, internal/adapters/outbound/kafka, internal/adapters/outbound/memory, internal/adapters/outbound/outbox, internal/adapters/outbound/postgres, internal/adapters/outbound/pricing, internal/adapters/outbound/repocontract, internal/adapters/outbound/shoppingcart, internal/adapters/outbound/telemetry. Where a type name below differs (the UML keeps the design names), the Ubiquitous Language page carries the built identifier.
1. The CheckoutSession aggregate
Derived from: model.yaml → contexts[checkout].aggregates[CheckoutSession]
(description, states, transitions, value_objects, commands,
invariants); storefront/apis/checkout/openapi.yaml for the field names
the model's description lists in prose (quoteExpiresAt, totalMinor,
amountMinor).
SessionStatus is the string enumeration of the eight states OPEN,
AUTHORIZING, DECLINED, PLACING, REQUOTE_REQUIRED, COMPLETED,
EXPIRED and FAILED.
Omitted: the Err... variables (ErrCartNotCheckoutReady,
ErrPriceQuoteExpired, ErrSessionClosed, ErrAuthorizationMismatch,
ErrPlacementInDoubt; listed on the
Aggregate Design Canvas).
placementRequest is the stored, PII-free body the model describes but does
not name as a type (hotspot H9 on
EventStorming); it is shown as
bytes because it is replayed byte for byte. Tier (SAME_DAY, NEXT_DAY, TWO_DAY, STANDARD) is the network
delivery-promise vocabulary, re-declared locally as a string enumeration: there is no shared kernel.
The method signatures are the design; the model names the commands, not their
parameters.
2. Events and policies
Derived from: model.yaml → contexts[checkout].publishes, .policies.
Omitted: the CloudEvents envelope (built in the Kafka adapter).
ExpireOnQuoteExpiry leads to ExpireSession, which raises no event
(hotspot H7), so it has no arrow here. GroupAmount is the
groups(groupNo, tier, amountMinor) entry of CheckoutCompleted.
3. Hexagonal ports and adapters
Derived from: model.yaml → contexts[checkout].aggregates, .inbound,
.sync_calls, .policies; conventions.integration_rules (outbox,
Idempotency-Key); the fleet's Go hexagonal layout. consumes is empty, so
there is no inbound Kafka consumer and no inbox. sync_calls holds six
rows, so there are five outbound REST clients: four plain clients and
the customerordering adapter, which the model names as the Anti-Corruption
Layer (internal/adapters/outbound/customerordering) and the only place that
knows the network's wire names.
Omitted: the composition root (cmd/checkout), metrics and tracing. The
port names (CartReader, OfferChecker, QuoteIssuer, PaymentAuthorizer,
OrderPlacer) and the four plain adapter packages follow the fleet
convention and are not named in the model; only customerordering is. The
scheduler is an inbound adapter: time triggers ExpireSession and
ResolveInDoubtPlacements. The read route (GetSession) reads the repository
through its port without a use case.
As built (51e0379), two more inbound adapters exist, and the model does not
name either: mcp (cmd/mcp, service ADR 0005)
and a2a (cmd/a2a, service ADR 0007).
Both are read-only and call the GetSession use case (internal/application/usecases),
the same one the REST read route uses: the MCP tool get_checkout_session and
the A2A skill checkout_session_status, both L1 inform. No write use case is
wired into either binary, so neither can reach the outbox, Kafka or a sibling
service. Both are separate deployables: cmd/mcp on :8090 (route
/api/mcp/checkout through the Agent Router, switched off in warehouse-infra),
cmd/a2a on :8093 (route /api/a2a/checkout, deployed). There is no auth on
REST, MCP or A2A; the in-cluster boundary is the access control. See
Service and operations.