Customer Payments
Derived from model/model.yaml. The customer-payments service is built on develop (IQVO/customer-payments at 054b3de, 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.
Customer Payments (customer-payments, code CP, tier storefront)
moves money with the shipment facts. checkout asks it
for one PaymentAuthorization per checkout session, split into allocations
(one per shipment group). From then on the money follows the network's
facts, not storefront commands: a shipped group is captured
(CaptureOnShipment), a cancelled group is released
(ReleaseOnCancellation), a lost or returned package is refunded
(RefundOnLostPackage, RefundOnReturnToSender), and uncaptured allocations
are re-authorized before the provider's authorization validity runs out
(ReauthorizeBeforeExpiry). Because the shipment facts can arrive before the
order is bound to its authorization, they are parked and applied on
CheckoutCompleted (gap S4). The context speaks to the payment provider
only through an Anti-Corruption Layer port (Authorize, Capture, Void, Refund,
Reauthorize); the payment-provider simulator is the stand-in adapter. It never
sees a card number, only PSP tokens.
This context's pages
| Page | What it holds | ddd-crew tool it follows |
|---|---|---|
| Business Context | The problem, actors, decisions, relation to real storefronts, out of scope | (narrative) |
| Ubiquitous Language | Terms, code identifiers, terms not to confuse | Bounded Context Canvas (UL section) |
| Core Domain Chart | Why this context is Generic | Core Domain Charts |
| Bounded Context Canvas | Purpose, classification, roles, inbound and outbound messages, decisions, metrics | Bounded Context Canvas v5 |
| Context Map | Every neighbour, direction and pattern, including the provider ACL | Context Mapping |
| Aggregate Design Canvas | PaymentAuthorization and Refund: states, invariants, commands | Aggregate Design Canvas v1.1 |
| Domain Events | Published and consumed CloudEvents, with an example envelope | Domain Message Flow Modelling (message catalogue) |
| Domain Message Flow | Authorize, capture on shipment, release, refund, parked facts | Domain Message Flow Modelling |
| EventStorming | Process-level boards with hotspots | EventStorming glossary & cheat sheet |
| Use Cases | One section per command: trigger, flow, errors, events, idempotency | (application layer, fleet convention) |
| Class Diagram | Domain model and hexagonal ports and adapters (the model's design, with the as-built packages) | (UML, fleet convention) |
| Entity Relationship | Postgres schema as built (migration 0001) | (fleet convention) |
| Sequence Diagrams | Adapter to Kafka and provider for every command use case | (UML, fleet convention) |
Service and operations
- Service:
IQVO/customer-paymentsondevelop(054b3de, checked 2026-12-02): binariescmd/api,cmd/mcp,cmd/a2a; REST contractapis/openapi.yaml, event contractapis/asyncapi.yaml, schema ininternal/adapters/outbound/postgres/migrations/(see Entity Relationship). 8 ADRs (0001 to 0008), listed in the ADR index. - Configuration: mandatory at boot (the service exits naming the missing variable):
DATABASE_URL,KAFKA_BROKERS,PAYMENT_PROVIDER_URL,CHECKOUT_CONSUMER_GROUP,ORDER_SOURCING_CONSUMER_GROUP,SHIPPING_AND_TRACKING_CONSUMER_GROUP. There is no in-memory mode. Packaging: the Helm chartcharts/customer-payments(ondevelopand in v0.1.4) renders the api and, both default off, anmcpand ana2acomponent with their own Services, routes and probes. - Deployment: released at v0.1.4 (tag commit
ac6e6b3, which carriescmd/api,cmd/mcp,cmd/a2aand the chart) and applied to the k3s cluster: warehouse-infradevelop(d12d05f, checked 2026-12-02) registers customer-payments interraform/apps.yaml(with a database) and configures it inhelm-values/customer-payments.yaml, with a dashboard and alert rules. REST goes through Kong at/api/customer-payments; the helm values give the three consumer groupscustomer-payments-checkout,customer-payments-order-sourcingandcustomer-payments-shipping-and-trackingand pointPAYMENT_PROVIDER_URLat the in-cluster payment-provider-simulator. The A2A agent is switched on (a2a.enabled: true) behind the route/api/a2a/customer-paymentsthrough the Agent Router (Envoy Gatewayagent-router, warehouse-infra ADR 0014). Checked 2026-12-02:customer-payments-a2aat 1/1; the api deployment at 0/1, its pod Pending on the NotReady nodek3s-agent2. The MCP server is not deployed: see MCP. - Observability: service ADR 0004, Adopt the fleet observability standard (logs, metrics, traces), Accepted (2026-10-26). Logs, metrics and traces leave over OTLP/gRPC (
OTEL_EXPORTER_OTLP_ENDPOINT, code defaultlocalhost:4317;OTEL_SERVICE_NAME); a collector that is down only drops telemetry. The Tier-2 business counter ispayments.authorizations.decided(unit{authorization}, ininternal/adapters/outbound/telemetry/payment_metrics.go), with attributeoutcome=authorized,declinedorfailedandreasonon the outcomes that are not a success. The warehouse-infra dashboardterraform/dashboards/contexts/customer-payments.jsonshows the gateway, the logs and the Go runtime; it does not query the counter. - MCP:
cmd/mcpis a read-only MCP server: the official Go SDK over Streamable HTTP,MCP_ADDR(default:8090),/mcpand an open/healthz, no auth (the in-cluster boundary is the access control). Four tools, every one L1 inform (reads, changes nothing; the pinned registryinternal/adapters/inbound/mcp/testdata/tool_registry.golden.jsoncarries_metacom.warehouse/authority: L1andreadOnlyHinton each):get_payment_authorization(one authorization by id: state, allocations per shipment group with their capture state and tracking numbers, expiry, decline reason),list_payment_authorizations(the authorizations of one order or of one checkout session, declined attempts included, at most 1000),get_refund(one refund by id: state, reason, attempts, last failure code) andlist_refunds(the refunds of one order, at most 1000). Each mirrors its REST read through the same use case; authorizing, voiding, capturing, releasing and refunding have no tool. Service ADR 0007, Agent authority levels and complete MCP surface (Accepted 2026-11-02), completes the surface with one scoped resource,warehouse://customer-payments/orders/{orderId}/payment-status(every authorization and refund of one order), and one prompt,investigate_order_payment(an operator's investigation procedure), and makes the handler stateless. The chart'smcpcomponent (port 8090, route/api/mcp/customer-paymentsthrough the Agent Router, rewritten to/mcp) is default off andhelm-values/customer-payments.yamlsets nomcpblock: the MCP server is registered in warehouse-infra and switched off, so it is not deployed. - A2A:
cmd/a2ais a read-only A2A agent (service ADR 0005, A2A inbound adapter, Accepted 2026-10-30; first commit108cf49): the official A2A Go SDK, JSON-RPC 2.0 over HTTP,A2A_ADDR(default:8093),A2A_AGENT_URLmandatory (the absolute URL the Agent Card advertises), the card at/.well-known/agent-card.jsonwithnamecustomer-payments,versionfromSERVICE_VERSION, providerIQVO,streaming: falseand no security schemes; no auth. Two skills, both taggedauthority:L1(inform):get_payment_status(Where does a payment stand: the authorizations of one checkout session or one order, or one authorization by id, with allocations, expiry and decline reason) andget_refund_status(How did a refund go: the refunds of one order, or one refund by id, with reason, attempts and failure code). Both read through theGetAuthorization,ListAuthorizations,GetRefundandListRefundsuse cases the REST and MCP adapters use; nothing here authorizes, voids, captures or refunds, and no PSP token or payment instrument is exposed. A2A is delegation only: facts still travel as CloudEvents on Kafka. Route/api/a2a/customer-paymentsthrough the Agent Router (rewritten to/),a2a.enabled: truein warehouse-infra; applied to the k3s cluster,customer-payments-a2aat 1/1 checked 2026-12-02. - Payment provider: reached over HTTP at
PAYMENT_PROVIDER_URL; in development and tests that ispayment-provider-simulator.
Elsewhere
- REST contract:
storefront/apis/customer-payments/openapi.yaml(a copy of the service's spec on develop), rendered under the API reference. - The storefront-wide Context Map, Subdomain Classification and Ubiquitous Language.
- The Model Gap Register
tracks gap S4 (event order across topics: fulfilment facts for an unbound
order are parked and applied on
CheckoutCompleted) and, on the checkout side, gap S3 (requote after authorization: void, then re-quote). - order-sourcing publishes the
FulfillmentShippedandFulfillmentCancelledfacts and shipping-and-tracking thePackageLostandPackageReturnedfacts that drive capture, release and refund (Conformist). - checkout calls
AuthorizePaymentandVoidAuthorizationand publishesCheckoutCompleted; shopping-cart is the other consumer of that event.