Skip to content

[#548] Add bounded charge reconciliation - #552

Open
Jagadeeshftw wants to merge 1 commit into
Agentpay-Org:mainfrom
Jagadeeshftw:feat/issue-548-charge-reconciliation
Open

[#548] Add bounded charge reconciliation#552
Jagadeeshftw wants to merge 1 commit into
Agentpay-Org:mainfrom
Jagadeeshftw:feat/issue-548-charge-reconciliation

Conversation

@Jagadeeshftw

Copy link
Copy Markdown
Contributor

Summary

Adds a callable, side-effect-free reconciliation job that detects charge ledger drift and returns a deterministic operator report.

What changed

  • Defines explicit amount, capture/refund, lifecycle-status, identifier, and duplicate-ID invariants.
  • Exposes individually testable checkChargeInvariants checks and a runChargeReconciliation job entry point.
  • Scans iterables in bounded chunks without materializing an unbounded dataset.
  • Reports scan limits, truncation, violation counts, offending IDs, stable invariant codes, and reasons.
  • Keeps scans idempotent and non-mutating; no automatic remediation is performed.
  • Adds typed ChargeReconciliationError handling for invalid scan options.
  • Adds unit and store-to-job integration coverage for clean data, amount imbalance, status drift, large datasets, deterministic ordering, duplicate IDs, repeated scans, and non-mutation.
  • Documents the charge model, invariants, bounds, report contract, and operational guidance.

Verification

  • npm run build
  • npm run lint
  • node --test dist/chargeReconciliation.test.js dist/chargeReconciliation.integration.test.js (13 passing tests)

Closes #548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reconciliation job that detects and reports charge state drift

1 participant