Commit graph

1 commit

Author SHA1 Message Date
ef26b57ce2 feat(payments): add reconcile-helcim-payments script for backfill + ongoing sync
Iterates every Member with helcimCustomerId, pulls their recent
transactions via listHelcimCustomerTransactions, and upserts a Payment
row per tx using the shared upsertPaymentFromHelcim helper (idempotent
via unique helcimTransactionId index). No confirmation emails are
sent during reconciliation.

Dry-run by default; pass --apply to write. Uses:
- Launch-day backfill for the ~34 pre-existing members.
- Nightly cron/scheduled function post-launch to catch recurring
  Helcim charges that bypass the synchronous write paths in
  subscription.post.js and update-contribution.post.js.

Written as .mjs rather than .cjs (scripts/*.js is gitignored; .cjs
would need dynamic imports for ESM server utils). Shims Nitro's
useRuntimeConfig + createError globals so helcim.js loads outside
the Nitro runtime.
2026-04-20 13:21:56 +01:00