Skip to main content

Function: interestUpdateFor()

interestUpdateFor(inv, facility, todayIso): InterestUpdate | null

Defined in: src/lib/interest/index.ts:83

The ONE decision for what an interest recompute writes on an invoice — shared by the nightly cron and the manual recompute action so they can never drift. Returns the update payload, or null when there is nothing to write: no due date, or nothing accrued to clear on a disabled/zero-outstanding invoice. Suppressing that no-op write matters — every UPDATE fires the row-level audit trigger into a table retained for 10 years.

Parameters​

inv​

InvoiceInterestRow

facility​

FacilityInterestRow | null | undefined

todayIso​

string

Returns​

InterestUpdate | null