Optionalnow?: () => InstantThe issue clock. Tests pin it to land invoices on a chosen Chicago day.
OptionalreceiptPageSize?: numberRows per page of republishUnsentReceipts; tests shrink it.
Protected ReadonlydbStaticinstanceThe process default: built from each dependency's own instance().
The dashboard's Charge again. An escalated month whose invoice was never
emailed, as the sweep leaves a reissue at the retry limit, has it emailed
instead (INVOICE_SENT); the next Charge again charges once delivered.
OptionalbillingDate?: stringYYYY-MM-DD in the billing timezone; today when omitted.
Ask ops to chase a month at RECURRING_FEE_RETRY_LIMIT and stamp its live
invoice so the sweep leaves it. Posts once per customer-month under a fixed
envelope id, confirmed before the stamp so a crash reposts, never drops.
ProtectedforWhether SES accepted the invoice email. A skip counts only when recorded
at or after since, so the skip that blocked last night's attempt does
not fail tonight's before the lambda has handled the republish.
The month's invoice, issued if none, numbered CFX-YYYYMMDD-NN under an
advisory lock on the date. Unmailed and uncharged, it takes the current
terms; billingDate is charge's, so both refuse a later month alike.
OptionalbillingDate?: stringYYYY-MM-DD in the billing timezone; the issue clock's date when omitted.
Unbilled months for the sweep: before before with no COMPLETED charge,
the previous month uninvoiced, and before once CANCELLED. Waived drop,
escalated stay with ops unless CANCELLED, each with its reason if known.
Publish the invoice email event unless already mailed or voided.
publishedAt is the database clock email_delivery rows use, so a waiter
can ignore a skip recorded for an earlier publish.
Publish the receipt event for a settled recurring charge with a live
invoice. Finds the invoice by customer and period, not fee_transfer_id:
the transfer can settle before charge links it, so it links it here.
Tell operators which customers the sweep left unbilled: an earlier month
only while still open after the run and once (a failed child's is under
failed), with its reason, such as paused, when the fee no longer bills.
OptionalbillingDate?: stringThe sweep's listing date; the clock's date for a sweep that predates it.
Charges whose child workflow failed tonight.
Earlier months still open when the sweep started.
Republish receipts settled one hour to seven days ago and never sent,
paging through all so unsendable ones cannot crowd out the rest. The fixed
event id dedupes; republished counts SNS accepts, and a refusal throws.
OptionalcustomerIds?: string[]Optionalescalated?: booleanOmit for both; true keeps only invoices escalated to ops.
Optionalids?: string[]Optionalpage?: numberOptionalpageSize?: numberOptionalpaid?: booleanOmit for both; false keeps only months with no COMPLETED charge.
OptionalperiodKeys?: string[]Optionalvoided?: booleanOmit for both; false keeps only the live invoice of each month.
Optionalwaived?: booleanOmit for both; false drops waived invoices.
Close a month that ended unbilled with the fee PAUSED or the customer not ACTIVE. A sweep past the billing day records it with a voided invoice, which a resume reissues past; next month's sweep waives it if still inactive. Idempotent per customer-month; not emailed.
Issues each month's invoice and publishes the events that email it and its receipt. The terms promise the invoice before payment, so the sweep waits for the invoice email before
charge, which also refuses an undelivered one.