Skip to main content

Interface: OutstandingInvoice

Defined in: src/lib/reconcile/index.ts:17

Pure check-to-invoice reconciliation (no I/O).

Allocates a received check across a facility's outstanding invoices in the given order (the caller passes them oldest-first), paying each up to its outstanding balance — or up to capCents when the payer's remittance line stated a smaller amount — until the check is exhausted; touched invoices may end partial. Corrections over the spec's matcher (build plan §3):

  • An invoice is fullyPaid iff the amount applied equals ITS outstanding balance — so a check that fully pays invoice #1 and partially pays #2 marks #1 paid and #2 partial (the spec's "applications.length === 1" heuristic got this wrong). A capped (short-paid) invoice is therefore partial even when its whole cap was applied.
  • All math is in integer cents (no remaining > 0.01 float compares).
  • An empty invoice list is handled (whole check is leftover/credit). Reconciliation only SUGGESTS; an admin confirms before anything is applied.

Extended by

Properties

capCents?

readonly optional capCents?: number

Defined in: src/lib/reconcile/index.ts:27

The amount the payer's matched remittance line put on this invoice, in cents. A stub line below the outstanding balance is a deliberate SHORT-PAY — greedily saturating the invoice anyway would silently take the difference from a later line's invoice, so application is capped at min(capCents, outstanding). Absent/undefined = no line amount known, apply up to outstanding.


invoiceId

readonly invoiceId: string

Defined in: src/lib/reconcile/index.ts:18


outstandingCents

readonly outstandingCents: number

Defined in: src/lib/reconcile/index.ts:20

Remaining balance (invoice total − amount already paid), in cents; values ≤ 0 are skipped.