feat(payments): add payments schema and persistence - #220
Merged
Conversation
Add the payments service database baseline in its own `payments` schema: the payments aggregate table plus the payment-events log, the inbound processed-webhooks dedup table, and the service's own outbox_events (same shape as the ledger outbox, including the lease column and the claimable indexes). All changesets are idempotent formatted SQL. Add the JPA entities (optimistic-locked aggregate, immutable insert-only logs) reusing Money and PaymentStatus, their Spring Data repositories, and a Testcontainers round-trip integration test that runs the migrations and verifies field fidelity. Closes #209
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
Second slice of E-02 Payments. Adds the payments persistence baseline in a dedicated
paymentsschema.payments(aggregate: amountNUMERIC(38,18)+CHAR(3)currency, status CHECK over the 6PaymentStatus,version),payment_events(append-only log),processed_webhooks(inbound dedup bydelivery_id),outbox_events(the service's own outbox, mirroring the ledgerplatform.outbox_eventsincl.leased_at+ pending/claimable partial indexes).PaymentEntity(@Version, write-once columnsupdatable=false),PaymentEventEntity/ProcessedWebhookEntity(@Immutable),PaymentOutboxEventEntity(mirrors the ledger outbox entity), four Spring Data repositories. App-assigned UUIDs (no@GeneratedValue);gen_random_uuid()kept as a non-JPA-insert defence per the ledger precedent.@DataJpaTest+ Testcontainers Postgres runs the changelog and round-trips each entity (amount precision viacompareTo, enum, version, JSON payload, webhook dedup).Payments owns its own outbox, separate from the ledger's
platform.outbox_events; the shared dispatcher (#210) will read it through a store port.Gates
Local (
-x integrationTest)::services:payments:{test,detekt,detektTest,spotlessCheck,assemble,compileIntegrationTestKotlin}green. critic GO, security-auditor PASS, evaluator 0.86. The migration + round-trip IT runs on CI. One follow-up tracked for #214: tighten the webhook-dedup test to a real INSERT conflict (DB PK already enforces dedup).Closes #209