This project is a domain-driven design study. It is not associated with, endorsed by or affiliated with any company, and it uses no company's code, data, logos or trademarks. All names, figures and examples are illustrative or synthetic. · November 2026
Money follows shipment facts: capture on ship, release on cancel, refund on loss or return.
The provider sits behind one port, so a real provider can replace the simulator cleanly.
It never sees a card number, only provider tokens; its agent and MCP tools can read, not move money.
Swap the payment-provider simulator for a real provider adapter behind the existing port.
Customer Payments moves money with the shipment facts: it authorizes the quote total at checkout, captures each shipment group's allocation when it ships, releases on cancellation, refunds lost or returned packages, and re-authorizes uncaptured allocations before the provider's authorization validity expires…
It authorizes at checkout, captures per shipment group on shipping, and releases, refunds or re-authorizes as facts arrive.
A simulator stands in for a real provider, so partial captures, provider timeouts and reconciliation go untested.
Holds the quote total for each checkout session, or declines it.
Charges each shipment group's share only when it actually ships.
Frees held money when fulfilment is cancelled or cannot be sourced.
Refunds lost or returned packages, never more than was charged.
Renews uncaptured holds before the provider's authorization lapses.
Links each completed checkout's order to its authorization and allocations.
OpenTelemetry SDK -> OTLP/gRPC -> in-cluster Collector -> Jaeger (traces) and Prometheus (metrics); stdout JSON logs shipped by Alloy to Loki (fleet observability standard ADR)
Ranked against all 45 briefed repositories (dot = one repository, highest on the left).
The simulator stands in for a real PSP: partial captures, provider timeouts and webhook-style reconciliation are unexercised
Swap in a real provider adapter behind the existing Authorize, Capture, Void, Refund, Reauthorize port.
Money moves on consumed facts - a missed logistics event strands allocations until the expiry / reauthorization policy catches them
Expiry and re-authorization policies catch stranded allocations; a reconciliation report is planned.
Refunds cap at 5 attempts with an over-refund invariant; a PSP outage leaves operator-driven REST retries as the only path
Operators can retry over REST, and deterministic provider keys keep those retries idempotent.
Every REST, MCP and A2A endpoint is unauthenticated by decision (fleet-wide auth revert 2026-09-11, TestNoAuthMiddlewareReintroduced)…
No mitigation on the roadmap yet: this one needs an owner.
Customer payments charges only for what ships and refunds what is lost, with the provider behind one port
| Style | Hexagonal (ports and adapters) with two aggregates (PaymentAuthorization, Refund), event-driven policies, transactional outbox + inbox, PSP Anti-Corruption Layer |
| Layout | cmd/{api (REST :8080, outbox relay, 3 consumer groups, clock-driven policy loop), mcp (read-only MCP :8090), a2a (agent :8093)}… |
| Storage | PostgreSQL (payment_authorization + refund aggregates, transactional outbox, inbox, idempotency; golang-migrate) + Kafka (produces 8 event types… |
| Testing | Unit tests over domain, use cases and adapters (httptest over the real chi router), godog BDD (5 feature files), repository-contract suite, golden CloudEvents… |
| REST | 8 operations over 6 paths on :8080: /payment-authorizations, /payment-authorizations/{authorizationId}… |