Label: complexity: high
Points: 200
Description
The funded amount on an invoice may drift from the sum of individual payment records due to edge cases. This issue adds reconcilePayments(invoiceId) that fetches both the invoice state and all payment events, detects discrepancies, and returns a typed reconciliation report.
Technical Context
Involves a new src/reconciler.ts. Fetch invoice via getInvoice and payments via getPayments. Sum payment amounts and compare to invoice.funded. Define ReconciliationReport = { invoiceId: string; invoiceFunded: bigint; paymentsSum: bigint; discrepancy: bigint; reconciled: boolean }.
Acceptance Criteria
Label: complexity: high
Points: 200
Description
The
fundedamount on an invoice may drift from the sum of individual payment records due to edge cases. This issue addsreconcilePayments(invoiceId)that fetches both the invoice state and all payment events, detects discrepancies, and returns a typed reconciliation report.Technical Context
Involves a new
src/reconciler.ts. Fetch invoice viagetInvoiceand payments viagetPayments. Sum payment amounts and compare toinvoice.funded. DefineReconciliationReport = { invoiceId: string; invoiceFunded: bigint; paymentsSum: bigint; discrepancy: bigint; reconciled: boolean }.Acceptance Criteria
reconcilePayments(invoiceId: string): Promise<ReconciliationReport>exportedreconciled: truewheninvoiceFunded === paymentsSumdiscrepancyis absolute difference between the two valuesReconciliationReporttype exported fromsrc/index.tsanytypes