Skip to content

test(payments): add end-to-end lifecycle integration tests - #232

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-02-payments-lifecycle-its
Jun 18, 2026
Merged

test(payments): add end-to-end lifecycle integration tests#232
tiana-code merged 1 commit into
mainfrom
feat/E-02-payments-lifecycle-its

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

What

Eleventh slice of E-02: the end-to-end integration tests proving the assembled payment lifecycle on real Postgres (Testcontainers). Test-only — no production change.

One @DataJpaTest service-level suite wiring the real beans (PaymentService, PaymentOrchestrator, ScreeningEvaluator, SandboxBankProvider, PaymentWebhookHandler, WebhookSignatureVerifier, PaymentRetryServiceImpl) via @Import + a nested @TestConfiguration (the webhook secret, the default screening rule, the sandbox bank). Drives via the application services and asserts persisted status + outbox eventType/PENDING + the processed-webhook table at each step.

Scenarios: happy path (initiate -> screen -> submit -> webhook SETTLED -> SETTLED), bank rejection -> FAILED, webhook FAILED -> FAILED, idempotent initiate (one payment), webhook dedup (settle once), cancel -> CANCELLED, retry resume from SCREENING, and an invalid HMAC signature (rejected, state unchanged, no dedup row). Behaviour was cross-checked against source (the sandbox rejects on a reference marker, markSubmitted emits PaymentScreened, the sign helper matches the verifier).

Gates

Local (-x integrationTest): :services:payments:{test,detekt,detektTest,spotlessCheck,assemble,compileIntegrationTestKotlin} green. critic GO, security-auditor PASS (HMAC gate, dedup and idempotency genuinely covered; §5.3 clean; zero production diff), evaluator 0.90. The suite runs on CI (Build & Test, real Postgres) — the definitive check.

Closes #217

Exercise the assembled payment flow against real Postgres: initiate, screen,
bank submit and webhook settlement, plus cancellation, retry of a payment stuck
in screening, idempotent initiation, webhook deduplication and signature
rejection. The tests wire the real application beans and assert the persisted
status, the outbox events and the processed-webhook table at each transition.

Closes #217
@tiana-code tiana-code added this to the v0.2.0 milestone Jun 18, 2026
@tiana-code
tiana-code merged commit 49d45f0 into main Jun 18, 2026
8 checks passed
@tiana-code
tiana-code deleted the feat/E-02-payments-lifecycle-its branch June 18, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F-02.10 Payment lifecycle integration tests

1 participant