Skip to content

Payment SePay Gateway Rehearsal

Scope

This rehearsal isolates the two legacy SePay provider callbacks that the read-only legacy route inventory identifies:

  • POST /api/hooks/sepay-payment
  • POST /api/wallet/webhooks/sepay

The candidate route tables are:

  • deploy/gateway/routes.payment-sepay-native-example.json for Compose
  • deploy/gateway/routes.payment-sepay-native-localhost-example.json for a localhost gateway and payment-service on port 8096

Each route is exact and POST-only. It forwards to the existing payment-owned legacy normalization adapters:

Public compatibility pathCandidate target
/api/hooks/sepay-payment/v1/legacy/hooks/sepay-payment
/api/wallet/webhooks/sepay/v1/legacy/wallet/webhooks/sepay

Gateway intentionally does not require an end-user JWT or organization header on these provider callbacks. payment-service retains SePay API-key, HMAC, and optional timestamp verification before it normalizes or persists a webhook.

Verification

bash
make test-payment-sepay-routes
PAYMENT_SEPAY_GATEWAY_ISOLATED_CONFIRM=disposable-runtime \
  make test-payment-sepay-gateway-isolated
GOTOOLCHAIN=go1.25.11 go test ./services/api-gateway/internal/gateway \
  -run TestGatewayPaymentSePayCandidateRoutesPreserveProviderPayloadAndFallbacks \
  -count=1 -v
GOTOOLCHAIN=go1.25.11 go test ./services/payment-service/internal/http \
  -run 'TestLegacySePay|TestPaymentWebhookReplayDoesNotDuplicateTransaction' \
  -count=1 -v
make test-monetization-event-chain test-monetization-broker-transport

The Gateway test proves exact path rewriting, raw JSON body forwarding, X-SePay-Webhook-Api-Key and request-ID preservation, the native route headers, and that wrong methods or nested paths fall back to legacy.

The opt-in isolated runtime builds temporary memory-backed payment-service and Gateway binaries on unused ports, requires an isolated X-SePay-Webhook-Api-Key, and writes request/response headers, service logs, route table, and a summary to output/qa/payment-sepay-gateway-isolated-<timestamp>/. A fresh local run on 2026-07-15 recorded 0.84ms for the flat wallet callback and 0.86ms for the nested subscription callback. Those numbers are local process evidence only, not a provider latency SLO.

Boundary And Rollback

deploy/gateway/routes.json keeps /api/hooks and /api/wallet legacy-proxied. No default route, frontend caller, payment provider credential, or legacy source is changed by this rehearsal.

This is an isolated route/runtime proof, not live SePay traffic, browser proof, or public promotion. Before promotion, retain current external provider and downstream replay artifacts, review the candidate, and rehearse rollback by restoring:

bash
GATEWAY_ROUTE_TABLE=deploy/gateway/routes.json

Go-platform documentation is generated from repository Markdown.