2.2 KiB
2.2 KiB
After refinement-phase-6 — Money-path correctness completion
Track: backend (money path). Gate: dotnet build 0 new warnings · dotnet test 396 pass (+13). Migration
RefinementPhase6MoneyFks scaffolded (additive: 3 FK sets + invoice index + delete of a dead config seed row).
What's now live (new endpoints — admin)
POST api/v1/admin_refunds/{id}/confirm_settlement— settle aprocessingBNPL/manual refund (processing → succeeded, posts the deferredrefund_payable ↔ escrow_heldclearing). Idempotent.POST api/v1/admin_refunds/{id}/mark_failed— fail aprocessingrefund (no ledger). Body{ "reason": "..." }(optional). Idempotent.- Both return
RefundSettlement{ refundId, bookingId, status, completedAt }. Contract:dev/contracts/domains/refunds-invoices.md; snapshotswagger.v1.jsonrefreshed.
What changed under the hood (no client-visible shape change)
- The BNPL provider cash-back callback now auto-settles the matching
processingrefund (arefund/revert completed|confirmed|settled/cashbackevent) — so a real BNPL revert reachessucceededwithout an admin click. - Refund create persists the row (
approved) before the external channel call (crash-window fix) — an interrupted refund is now a reconcilableapprovedrow, not a lost execution. - Forward-dep FKs added:
refunds.ticket_id,nurse_clawbacks.original_payout_id/recovered_in_payout_id,invoices.partner_center_id(+ index). All nullable,NO ACTION. No behavior change; integrity backstop only. - Audit:
Refund/NurseClawback/NursePayout/NursePayoutBatch/NurseVerificationare nowIAuditable→ admin decisions leave anaudit_logsdiff row (IBAN redacted). - Retired the orphaned
refund_ticket_requiredconfig key (a refund ticket is always auto-opened).
Frontend notes
- The customer refund-status flow is unchanged — a BNPL refund still shows
processingwith the ETA, and now actually flips tosucceededonce settled (via admin confirm or the provider callback). No new client work required for the customer side. - If/when an admin refund console surfaces settlement, the two new endpoints are the actions (staff-gated,
sensitiverate policy).