test(payments): add end-to-end lifecycle integration tests - #232
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
@DataJpaTestservice-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 + outboxeventType/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,
markSubmittedemitsPaymentScreened, 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