Skip to main content

Context Map

Following ddd-crew Context Mapping. This is checkout's slice of the storefront-wide context map: every relationship this context has, with the upstream (U) and downstream (D) side, the pattern and the channel.

Source: cmd/api/adapters.go (the five outbound gateways), internal/adapters/outbound/kafka/encoder.go (the topics and events), internal/adapters/inbound/http/server.go (the routes the BFF calls); the consumers of CheckoutCompleted are named in apis/asyncapi.yaml.

Legend: arrows point from upstream to downstream, except the dotted synchronous calls, which are drawn with the caller (checkout) on the left and labelled with the true direction. A thick arrow is a Kafka event relationship. The path parameters {cartId} and {offerId} are written cartId and offerId inside the diagram.

Omitted, because they have no edge with this context (Separate Ways): product-content and product-discovery (checkout reads neither; the cart and pricing already carry what it needs), offer-availability, order-sourcing and shipping-and-tracking (network; their fulfilment facts reach the storefront through customer-payments, never through checkout), and the payment provider itself, which only customer-payments talks to through its provider port. Checkout never touches a warehouse.* topic.

Relationships​

NeighbourDirectionPatternChannelMessagesWhy this pattern
storefront-bff (experience layer)checkout upstream, BFF downstreamUIREST POST /checkout-sessions, POST /checkout-sessions/{sessionId}/confirmations, GET /checkout-sessions/{sessionId}OpenSession, ConfirmSession; GetSessionThe BFF is the only storefront edge; it mints the Idempotency-Key, shows the binding total and polls a PLACING session.
shopping-cart (Supporting)cart upstream, checkout downstreamCustomer/Supplier (checkout is the Customer)REST GET /carts/{cartId}GetCartCheckout reads the cart, its version and its readiness inside the session-open request; the read shape is negotiated for the saga.
shopping-cart (Supporting)checkout upstream, cart downstreamCustomer/Supplier (SC is the Customer)Kafka retailnetwork.checkout.eventsCheckoutCompletedThe cart closes itself (CloseOnCheckoutCompleted) on the fact, instead of checkout calling back synchronously.
pricing (Core)pricing upstream, checkout downstreamCustomer/Supplier (checkout is the Customer)REST POST /price-quotesIssuePriceQuote (command)Same domain, negotiated contract: pricing issues the binding, expiring quote and checkout records its id, totals and expiry.
customer-payments (Generic)payments upstream, checkout downstreamCustomer/Supplier (checkout is the Customer)REST POST /payment-authorizations, POST /payment-authorizations/{authorizationId}/voidsAuthorizePayment, VoidAuthorization (commands)The authorize and void shapes (idempotency keys, allocations per group) are negotiated between the two; payments owns the provider vocabulary.
customer-payments (Generic)checkout upstream, payments downstreamCustomer/Supplier (CP is the Customer)Kafka retailnetwork.checkout.eventsCheckoutCompletedPayments binds the orderId to the session's authorization on the fact (BindOrderOnCheckoutCompleted).
delivery-promise (network, Core)DP upstream, checkout downstreamOpen Host Service (network side) with a conformist consumerREST GET /delivery-offers/{offerId}GetDeliveryOffer (query)The network publishes the route for the shopper / storefront caller; checkout uses it only at open, to pre-check that each selected offer is still QUOTED, with a 2-minute margin; a failure changes no state.
customer-ordering (network, Generic)CO upstream, checkout downstreamOpen Host Service (network side) behind an Anti-Corruption Layer (checkout side)REST POST /checkoutPlaceOrder (command)The ACL (internal/adapters/outbound/customerordering) is the only place that knows the network's wire names; it translates the network's "Checkout", offer-not-quotable and requotedOffers into the place-order step and the requote.
analytics consumerscheckout upstream, analytics downstreamanalytics streamKafka retailnetwork.checkout.analyticsCheckoutOpened, CheckoutDeclined, CheckoutRequoteRequired, CheckoutFailed, CheckoutSessionExpired, CheckoutPlacementInDoubtFunnel and operations facts only; no context consumes them.

Notes on the patterns​

  • The only Anti-Corruption Layer toward the network. The network's "Checkout" is a different word for a smaller thing: turning a cart into a customer order. Rather than letting that word and its error shapes leak into the session, the adapter translates them at the edge: the place-order step, REQUOTE_REQUIRED, FAILED. The other network edge (GetDeliveryOffer) is a plain Open Host Service read.
  • Checkout is Customer to everything it calls. All six synchronous calls are checkout asking; nobody calls checkout except the BFF, which is the point of a saga orchestrator.
  • No Shared Kernel. The service-tier enum and the offer shape are re-declared inside Group and RequotedOffer (internal/domain/checkoutsession/values.go); offerId, priceQuoteId and authorizationId are values copied from messages.
  • Checkout consumes nothing. There is no consumer: the session learns every outcome from the synchronous answer of the call it just made, and Idempotency-Key replay turns an unknown answer into a known one.
  • Two events carry the saga forward. CheckoutCompleted is the only integration event; the cart closes and payments binds. The other six are analytics-only.
  • The network never depends on the storefront. Checkout calls customer-ordering and delivery-promise; no network context calls a checkout route or consumes a checkout topic.
  • No warehouse-systems edge. Checkout never produces or consumes a warehouse.* topic.