Interface: OutstandingInvoiceView
Defined in: src/server/services/checks.ts:25
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
fullyPaidiff 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 thereforepartialeven when its whole cap was applied. - All math is in integer cents (no
remaining > 0.01float compares). - An empty invoice list is handled (whole check is leftover/credit). Reconciliation only SUGGESTS; an admin confirms before anything is applied.
Extends
Properties
capCents?
readonlyoptionalcapCents?: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.
Inherited from
dueDate
readonlydueDate:string|null
Defined in: src/server/services/checks.ts:28
invoiceId
readonlyinvoiceId:string
Defined in: src/lib/reconcile/index.ts:18
Inherited from
invoiceNumber
readonlyinvoiceNumber:string
Defined in: src/server/services/checks.ts:26
outstandingCents
readonlyoutstandingCents:number
Defined in: src/lib/reconcile/index.ts:20
Remaining balance (invoice total − amount already paid), in cents; values ≤ 0 are skipped.
Inherited from
OutstandingInvoice.outstandingCents
periodEnd
readonlyperiodEnd:string|null
Defined in: src/server/services/checks.ts:27