Digital storefront · Supporting domain · EventStorming board
checkout
Turns a ready cart into a placed order: a binding price, an authorized payment and an order handed on, with recovery when a step gives no clear answer.
- events published
- 7
- commands
- 7
- policies
- 11
- read models
- 3
- hot spots
- 4
The story in 5 key events
The pivotal events: the few that matter most, in the order they happen.
- Pivotal eventCheckout
Opened - Pivotal eventCheckout
Declined - Pivotal eventCheckout
Completed - Pivotal eventCheckout
Requote Required - Pivotal eventCheckout
Failed
Listens to (0): contexts whose events this one reacts to
none
Tells (2): contexts that react to its events
The board, row by row
11 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.
- Event
- Command
- Actor
- Aggregate
- Policy
- Read model
- External system
- Hot spot
- Opportunity
-
Open a checkout session
The shopper starts checkout from a ready cart. Checkout checks that every chosen delivery offer is still valid, gets a binding price quote from pricing and opens a session that lasts as long as the quote.
ActorShopperRead modelCart ready for checkoutRead modelDelivery offers still validRead modelBinding price quoteCommandOpenSession POST /checkout-sessionsAggregateCheckoutSession EventCheckoutOpened analytics stream onlySource: application/usecases/open_session.go · domain/checkoutsession/open.go
-
Confirm and place the order
The shopper confirms with a payment method token. Checkout has the exact quote total authorized, then places the order. Once the order is accepted the session is complete.
ActorShopperCommandConfirmSession POST /checkout-sessions/{sessionId}/confirmationsAggregateCheckoutSession EventCheckoutCompleted Systemshopping-cart PolicyCloses the shopper's cart as checked outSystemcustomer-payments PolicyBinds the order to the payment authorization and applies facts that waited for itSource: application/usecases/confirm_session.go · application/usecases/settle.go · domain/checkoutsession/terminals.go
-
Payment is declined
The payment is refused, or the amount authorized is not the quote total, in which case the hold is released. The session is declined and the shopper may try another payment method until the quote runs out.
ActorShopperCommandConfirmSession POST /checkout-sessions/{sessionId}/confirmationsAggregateCheckoutSession EventCheckoutDeclined analytics stream onlySource: application/usecases/confirm_session.go · domain/checkoutsession/transitions.go
-
The order needs new delivery offers
When the order is placed, an offer turns out to have changed and the order service sends new ones. The session ends as requote required with those offers and the payment hold is released.
ActorShopperCommandConfirmSession POST /checkout-sessions/{sessionId}/confirmationsAggregateCheckoutSession EventCheckoutRequote analytics stream onlyRequired Source: application/usecases/settle.go · domain/checkoutsession/terminals.go · adapters/outbound/customerordering/gateway.go
-
The order is refused
The order service rejects the order outright. The session fails with a code, an alert is raised and the payment hold is released.
ActorShopperCommandConfirmSession POST /checkout-sessions/{sessionId}/confirmationsAggregateCheckoutSession EventCheckoutFailed analytics stream onlySource: application/usecases/settle.go · domain/checkoutsession/terminals.go
-
The order service does not answer
The order service gives no clear answer. The session stays locked in placing and the shopper is told the order is still being processed. This is announced once, on the first unclear answer.
ActorShopperCommandConfirmSession POST /checkout-sessions/{sessionId}/confirmationsAggregateCheckoutSession EventCheckoutPlacement analytics stream onlyIn Doubt Source: application/usecases/settle.go · domain/checkoutsession/transitions.go
-
Settle an order that was in doubt
A sweep replays the stored order request with the same key until the order service answers. It alerts at 20 hours, and at 22 hours gives up, fails the session and releases the payment hold.
TimeOrder sweepPolicyEvery sweep, replay each unsettled order request and record the answerCommandResolveIn started by the clockDoubt Placements AggregateCheckoutSession EventCheckoutCompleted EventCheckoutRequote analytics stream onlyRequired EventCheckoutFailed analytics stream onlySystemshopping-cart PolicyCloses the shopper's cart as checked outSystemcustomer-payments PolicyBinds the order to the payment authorization and applies facts that waited for itSource: application/usecases/resolve_in_doubt.go · domain/checkoutsession/terminals.go
-
Settle a payment that never answered
A session left authorizing for over 2 minutes asks customer-payments again with the same key to learn the true outcome. The purchase then carries on as after a normal confirmation.
TimePayment sweepPolicyEvery sweep, any session authorizing for over 2 minutes asks again, with the same keyCommandResolveStuck started by the clockAuthorizations AggregateCheckoutSession EventCheckoutDeclined analytics stream onlyEventCheckoutCompleted Systemshopping-cart PolicyCloses the shopper's cart as checked outSystemcustomer-payments PolicyBinds the order to the payment authorization and applies facts that waited for itSource: application/usecases/policies.go · application/usecases/confirm_session.go
-
Release a payment hold that is still owed
When an order is refused or needs a requote, releasing the payment hold is recorded as a debt on the session. A sweep retries every minute until it works.
TimeRelease sweepPolicyEvery minute, retry each payment-hold release that is still owedCommandRetryOwed started by the clockVoids AggregateCheckoutSession Source: application/usecases/policies.go · application/usecases/settle.go
-
Let a session expire with its quote
A sweep expires every open or declined session whose price quote has run out. A session that is authorizing or placing is not touched.
TimeExpiry sweepPolicyEvery sweep, an open or declined session past its quote expiry becomes expiredCommandExpireOn started by the clockQuote Expiry AggregateCheckoutSession EventCheckoutSession analytics stream onlyExpired Source: application/usecases/policies.go · domain/checkoutsession/terminals.go
-
Forget old order requests
The stored order request is dropped 24 hours after a session closes. The session itself stays, and nothing is announced.
TimePurge sweepPolicyEvery sweep, drop the stored order request of sessions closed over 24 hours agoCommandPurgeStored started by the clockPlacements AggregateCheckoutSession Source: application/usecases/policies.go · domain/checkoutsession/terminals.go
Hot spots and opportunities
Open questions and known gaps, each taken from a decision record or a document in the repository, never invented.
- Hot spotHow the cart takes the requoted offers is open. Checkout only carries them; whether anything writes them into the cart is not verified here.
- Hot spotIf the order service never answers, the session stays locked for up to 22 hours before it fails and the payment hold is released.
Source: adr/0002-checkout-assumptions.md
- Hot spotOffers are checked only when the session opens. One that expires before confirmation surfaces later as a requote from the order service.
Source: docs/ddd/eventstorming.md
- Hot spotA failed release of a payment hold stays on the session as a debt, retried every minute. After an amount mismatch the shopper cannot confirm again until it clears.
Source: adr/0002-checkout-assumptions.md
This board is a reconstruction from the code and documentation of checkout at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.