Skip to content

Add payment reconciliation scheduled job to detect unmatched transactions #856

Description

@RUKAYAT-CODER

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.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions