Skip to main content

Context map

Following ddd-crew Context Mapping. This is Customer Payments' slice of the storefront context map: every relationship this context has, with the pattern and the channel.

Source: cmd/api/main.go (consumerSpecs: the three consumers), internal/adapters/inbound/http/server.go (routes), internal/adapters/inbound/kafka/handlers.go (consumed topics and types), internal/adapters/outbound/paymentprovider/client.go (the ACL), internal/adapters/outbound/kafka/payloads.go (TopicEvents), apis/asyncapi.yaml.

Arrows point from upstream to downstream, except the Kafka arrow from checkout, whose label gives the true direction. Solid = synchronous (REST, provider port); thick = Kafka.

Relationships​

NeighbourDirectionPatternChannelMessages
checkout (Supporting)we are upstreamCustomer/Supplier (checkout is the Customer)REST POST /payment-authorizations, POST /payment-authorizations/{authorizationId}/voids, GET /payment-authorizations/{authorizationId}authorize, void, get
checkoutcheckout is upstreamCustomer/Supplier (we are the Customer)Kafka retailnetwork.checkout.eventsCheckoutCompleted
storefront ops, agentswe are upstreamUIREST POST /refunds, GET /refunds..., GET /payment-authorizations...; MCP cmd/mcp; A2A cmd/a2arequest, retry and read
order-sourcing (network, Core)network is upstreamConformistKafka retailnetwork.order-sourcing.eventsFulfillmentShipped, FulfillmentCancelled, FulfillmentUnsourceable
shipping-and-tracking (network, Generic)network is upstreamConformistKafka retailnetwork.shipping-and-tracking.eventsPackageLost, PackageReturned
payment provider (external)we call itAnti-Corruption LayerPAYMENT_PROVIDER_URL, HTTP/JSONauthorize, capture, void, refund, reauthorize, reduce
analytics consumerswe are upstreamanalytics streamKafka retailnetwork.customer-payments.eventsthe eight events of Events

Notes on the patterns​

  • One ACL, and it is outbound. The domain sees a few provider verbs, a PSP token and deterministic idempotency keys; wire names, error codes and the shape of a hold reference are translated inside internal/adapters/outbound/paymentprovider. The same discipline keeps the card number out of the storefront.
  • Two Conformist edges from the network. The shipment, cancellation, lost and returned facts are taken as published; the context never asks the network to change a payload.
  • Cross-topic order is the price of event-driven money. The three inbound topics have no ordering between them, so a shipment fact can precede CheckoutCompleted. The answer is parking, not a synchronous call to any of the three.
  • The provider is the only synchronous call out. Every other flow is a Kafka event or an inbound call.
  • A dead end for events. Nothing consumes our events today (Integration).
  • No Shared Kernel. orderId, groupNo and trackingNumber are values copied from messages, never shared code.
  • Separate Ways with pricing, shopping-cart, product-content, product-discovery and every other network context; in particular no call to customer-ordering. No warehouse.* topic is touched.