Backend: payment status sync + batch reconciliation job #504

Open
opened 2026-08-29 03:27:45 +00:00 by gambit-admin · 0 comments
Owner

Parent: EPIC #499. Depends on #500 + #501.

What

  • Status check sync: use the iPOSpays transaction-status check endpoint (and/or V3 status) to poll unsettled/pending payment records — a jobs/ background job (Postgres job-queue pattern used by import worker / tcgcsv lanes; see backend/app/jobs/ and a scheduler entry) that:
    • marks payments whose callback never arrived as failed/etc.,
    • surfaces drfit between Gambit state and provider state on the Ops Desk (monitoring.py / signals conventions),
    • respects a per-run + per-day budget like the tcgcsv lanes.
  • Batch report: nightly pull (or manual trigger) of the day's batch/settlement (iPOS Transact batch-report endpoints) → summary surfaced in Ops Desk + logs; reconcile against our recorded iPOSpays tenders; alert on difference (Mattermost via services/notify.py pattern).

Out of scope

  • Rebuilding money math; this is provider-state convergence, not our transaction ledger.

Acceptance criteria

  • Job runs on schedule, no-op gated by ipospays_enabled + vendor config.
  • Offline-card sales (no iPOSpays record) are untouched — never flagged by the reconciler.
  • Tests for drift-detection cases: missing callback, refund-mismatch, extra provider charge; verify.sh green.
Parent: EPIC #499. Depends on #500 + #501. ## What - **Status check sync**: use the iPOSpays transaction-status check endpoint (and/or V3 status) to poll unsettled/pending payment records — a `jobs/` background job (Postgres job-queue pattern used by import worker / tcgcsv lanes; see `backend/app/jobs/` and a scheduler entry) that: - marks payments whose callback never arrived as failed/etc., - surfaces drfit between Gambit state and provider state on the Ops Desk (`monitoring.py` / signals conventions), - respects a per-run + per-day budget like the tcgcsv lanes. - **Batch report**: nightly pull (or manual trigger) of the day's batch/settlement (iPOS Transact batch-report endpoints) → summary surfaced in Ops Desk + logs; reconcile against our recorded iPOSpays tenders; alert on difference (Mattermost via `services/notify.py` pattern). ## Out of scope - Rebuilding money math; this is provider-state convergence, not our transaction ledger. ## Acceptance criteria - Job runs on schedule, no-op gated by `ipospays_enabled` + vendor config. - Offline-card sales (no iPOSpays record) are untouched — never flagged by the reconciler. - Tests for drift-detection cases: missing callback, refund-mismatch, extra provider charge; verify.sh green.
gambit-admin added the featureapi labels 2026-08-29 03:27:45 +00:00
gambit-admin added the 13 · cross-cutting label 2026-09-04 13:36:52 +00:00
Sign in to join this conversation.