Overview
Payments recorded in the local database may differ from the payment provider's ledger due to webhook failures or processing errors. Without periodic reconciliation, revenue discrepancies go undetected, causing financial reporting errors.
Specifications
Features:
- Daily reconciliation job that compares local payments with the payment provider's transaction list.
- Alert on any unmatched or mismatched transactions.
Tasks:
- Create
PaymentReconciliationJob scheduled daily via @Cron.
- Fetch transactions from the payment provider API for the previous day.
- Compare against
Payment table records by provider transaction ID.
- Log discrepancies as structured
PAYMENT_RECONCILIATION_MISMATCH audit events.
- Expose
GET /payments/reconciliation/report (admin-only) for last run results.
Impacted Files:
- New
src/payments/reconciliation/reconciliation.service.ts
src/audit-log/enums/audit-action.enum.ts
Acceptance Criteria
- Reconciliation job runs daily at 02:00 UTC.
- Mismatched transactions appear in the audit log.
- Admin endpoint returns the last reconciliation report.
Overview
Payments recorded in the local database may differ from the payment provider's ledger due to webhook failures or processing errors. Without periodic reconciliation, revenue discrepancies go undetected, causing financial reporting errors.
Specifications
Features:
Tasks:
PaymentReconciliationJobscheduled daily via@Cron.Paymenttable records by provider transaction ID.PAYMENT_RECONCILIATION_MISMATCHaudit events.GET /payments/reconciliation/report(admin-only) for last run results.Impacted Files:
src/payments/reconciliation/reconciliation.service.tssrc/audit-log/enums/audit-action.enum.tsAcceptance Criteria