Skip to main content

Domain Events

Released at v0.1.4, applied to the k3s cluster

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.

Every event this context publishes, from contexts[checkout].publishes, with the consuming contexts' entries for the one integration event. The model lists no consumed event (consumes: []). The domain-wide rules are on Event standard: CloudEvents.

Envelope​

Every Kafka message is a CloudEvents 1.0 event in structured JSON mode (conventions.cloudevents):

AttributeValue for this context
specversion1.0
ida UUID minted once when the event is written to the outbox; a redelivery carries the same id
source/retailnetwork/checkout
typecom.retailnetwork.storefront.checkout.checkoutsession.<EventName> (tier storefront, entity checkoutsession from the publishes rows)
subjectthe aggregate root id (sessionId)
timethe instant the fact happened, UTC
datacontenttypeapplication/json
dataschemaurn:retailnetwork:checkout:events:CheckoutCompleted:v1 for the integration event; as built the six analytics-only events carry urn:retailnetwork:checkout:analytics:<EventName>:v1 (service ADR 0004, encoder goldens)
Kafka topicretailnetwork.checkout.events for CheckoutCompleted; retailnetwork.checkout.analytics for the six analytics-only events
Kafka keysessionId, so one session's events stay on one partition and in order

Published​

Every event is written to outbox_events in the same transaction as the aggregate save, and a relay publishes it. CheckoutCompleted is the only integration event; the other six name their consumers as "analytics only" (Context Map).

CheckoutCompleted​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutCompleted
Topicretailnetwork.checkout.events
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:events:CheckoutCompleted:v1
Producing command / use caseRecordPlaced, after customer-ordering accepted the order (first call, or a replay by ResolveInDoubtPlacements)
Consumersshopping-cart, customer-payments
FieldTypeMeaning
sessionIdstringThe completed session.
orderIdstringThe order the network recorded.
shopperIdstringA reference to the shopper; no PII.
cartIdstringThe cart the session came from.
authorizationIdstringThe authorization held for the quote total.
currencystringThe one configured ISO 4217 currency.
totalMinorintegerThe quote total in minor units.
groupsarrayOne entry per shipment group: groupNo, tier, amountMinor (the allocation).
completedAttimestampWhen the session completed.

CheckoutOpened​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutOpened
Topicretailnetwork.checkout.analytics
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:analytics:CheckoutOpened:v1
Producing command / use caseOpenSession
Consumersanalytics only
FieldTypeMeaning
sessionIdstringThe session opened.
cartIdstringThe cart it was opened from.
shopperIdstringA reference to the shopper.
totalMinorintegerThe binding quote total.
openedAttimestampWhen the session opened.

CheckoutDeclined​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutDeclined
Topicretailnetwork.checkout.analytics
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:analytics:CheckoutDeclined:v1
Producing command / use caseRecordDecline (customer-payments declined the authorization)
Consumersanalytics only
FieldTypeMeaning
sessionIdstringThe session whose authorization was declined.
reasonstringThe decline reason.
attimestampWhen the decline was recorded.

CheckoutRequoteRequired​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutRequoteRequired
Topicretailnetwork.checkout.analytics
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:analytics:CheckoutRequoteRequired:v1
Producing command / use caseRecordRequoteRequired (a definitive 409 from the network, after the authorization was voided)
Consumersanalytics only
FieldTypeMeaning
sessionIdstringThe session that needs a requote.
requotedOffersarrayThe re-quoted offers: offerId, groupNo, tier, deliverByEarliest, deliverByLatest, expiresAt.
attimestampWhen the requote was recorded.

CheckoutFailed​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutFailed
Topicretailnetwork.checkout.analytics
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:analytics:CheckoutFailed:v1
Producing command / use caseRecordFailure (a 422 from the network: a contract bug; the authorization is voided and an alert is raised)
Consumersanalytics only
FieldTypeMeaning
sessionIdstringThe session that failed.
codestringThe failure code stored on the session.
attimestampWhen the failure was recorded.

CheckoutSessionExpired​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutSessionExpired
Topicretailnetwork.checkout.analytics
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:analytics:CheckoutSessionExpired:v1
Producing command / use caseExpireSession (policy ExpireOnQuoteExpiry, from OPEN or DECLINED)
Consumersanalytics only
FieldTypeMeaning
sessionIdstringThe session that expired.
attimestampWhen the expiry was recorded.

As built the payload is {sessionId, at} only (checkout ADR 0004 type catalogue, CheckoutSessionExpired.golden.json); the design's cartId and quoteExpiresAt were dropped and the model now says the same.

CheckoutPlacementInDoubt​

ItemValue
Full typecom.retailnetwork.storefront.checkout.checkoutsession.CheckoutPlacementInDoubt
Topicretailnetwork.checkout.analytics
Subject / keysessionId
Dataschemaurn:retailnetwork:checkout:analytics:CheckoutPlacementInDoubt:v1
Producing command / use caseRecordPlacementInDoubt on the first unknown outcome only (timeout or 503 from the network; the session stays PLACING; later ResolveInDoubtPlacements passes raise nothing)
Consumersanalytics only
FieldTypeMeaning
sessionIdstringThe session whose place-order outcome is unknown.
placingSincetimestampWhen the session entered PLACING (the clock of the 20 h alert and the 22 h give-up).
attimestampWhen the first in-doubt outcome was recorded.

ConfirmSession and RecordAuthorization raise no event: CheckoutCompleted already covers the outcome. Expiry and an in-doubt placement are operator facts, published analytics-only.

Consumed​

None. The model lists no consumed event for this context. The session reacts to the synchronous answer of each call it makes. The design names the consumer groups of the two consumers of CheckoutCompleted shopping-cart.checkout and customer-payments.checkout (as built each name comes from the consumer's CHECKOUT_CONSUMER_GROUP); both are idempotent on the CloudEvents id and dispatch on the full type string.

What the consumers do with CheckoutCompleted​

ConsumerFields usedWhat it does
shopping-cartcartId, sessionIdRuns CloseOnCheckoutCompleted: OPEN → CHECKED_OUT, publishing CartCheckedOut (analytics).
customer-paymentssessionId, orderId, authorizationId, groupsRuns BindOrderOnCheckoutCompleted: binds the orderId to the session's authorization, then applies any parked fulfilment facts (gap S4).

Ordering. CheckoutCompleted is keyed by sessionId, not cartId and not orderId; per-session order holds, nothing more is promised across topics. Fulfilment facts for the new order may reach customer-payments before this event does; that consumer parks them until the bind (gap S4 on the Model Gap Register). A session publishes CheckoutCompleted at most once, because COMPLETED has no transition out (ErrSessionClosed); a redelivery carries the same id and is acknowledged without effect.

Example envelope​

CheckoutCompleted, the one fact the cart and payments follow (all ids synthetic):

{
"specversion": "1.0",
"id": "b7d40f12-35ae-4c9b-8e61-0d2f9a47c3e8",
"source": "/retailnetwork/checkout",
"type": "com.retailnetwork.storefront.checkout.checkoutsession.CheckoutCompleted",
"subject": "ses-9c21d4",
"time": "2026-10-24T09:31:07Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:checkout:events:CheckoutCompleted:v1",
"data": {
"sessionId": "ses-9c21d4",
"orderId": "ord-71ab05",
"shopperId": "shp-30e8",
"cartId": "cart-4f8b1c",
"authorizationId": "auth-5d17f2",
"currency": "BRL",
"totalMinor": 24890,
"groups": [
{"groupNo": 1, "tier": "NEXT_DAY", "amountMinor": 15990},
{"groupNo": 2, "tier": "STANDARD", "amountMinor": 8900}
],
"completedAt": "2026-10-24T09:31:07Z"
}
}

The event carries references only: shopperId, orderId and authorizationId. No address, name, e-mail or card data appears in any checkout event (conventions.no_auth, meta.hard_boundary); the stored placement request that holds shipToAddressId never leaves the aggregate.