refactor(billing): split billing.ts by job #188

Sammanfogat
supernaut sammanfogade 1 incheckning från refactor/split-billing in i main 2026-10-18 19:12:25 +00:00
Ägare

Splits src/billing.ts by job. Code moves unchanged.

  • chargebacks.ts: applyChargeback, reverseChargeback and their helpers.
  • reconcile.ts: sweep, reconcile, endIfDue and the reconcile helpers.
  • billing-core.ts: what billing and chargebacks share (Deps, user lock, grant, revoke, endNow and related). It keeps the two from importing each other.
  • calendar.ts: the Amsterdam and Stockholm formatters and one zonedMidnight(zone, day), replacing amsterdamMidnight and stockholmMidnight. Both zones give the same result, since DST never changes at midnight.

billing.ts drops from 3632 to 2648 lines. 102 of 105 normalised top-level declarations are identical; the other three are the midnight helper rename. Typecheck, lint, build and the full suite (775 tests) pass. Tests change only in imports.

Not in this PR: splitting billing.test.ts.

Closes #120

Splits `src/billing.ts` by job. Code moves unchanged. - `chargebacks.ts`: `applyChargeback`, `reverseChargeback` and their helpers. - `reconcile.ts`: `sweep`, `reconcile`, `endIfDue` and the reconcile helpers. - `billing-core.ts`: what billing and chargebacks share (`Deps`, user lock, `grant`, `revoke`, `endNow` and related). It keeps the two from importing each other. - `calendar.ts`: the Amsterdam and Stockholm formatters and one `zonedMidnight(zone, day)`, replacing `amsterdamMidnight` and `stockholmMidnight`. Both zones give the same result, since DST never changes at midnight. `billing.ts` drops from 3632 to 2648 lines. 102 of 105 normalised top-level declarations are identical; the other three are the midnight helper rename. Typecheck, lint, build and the full suite (775 tests) pass. Tests change only in imports. Not in this PR: splitting `billing.test.ts`. Closes #120
supernaut lade till 1 incheckning 2026-10-18 19:03:34 +00:00
refactor(billing): split billing.ts by job
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m27s
57f5183f3d
Move chargeback handling to chargebacks.ts, the sweep and reconcile
pass to reconcile.ts, and the code both need to billing-core.ts.
Replace amsterdamMidnight and stockholmMidnight with one
zonedMidnight(zone, day) in calendar.ts, which also holds the two
zone formatters that billing.ts and withdrawal.ts each defined.

Code moves unchanged. billing.ts re-exports Deps. main.ts imports
sweep and reconcile from reconcile.ts.

Closes #120
supernaut sammanfogade incheckning a870417d75 till main 2026-10-18 19:12:25 +00:00
supernaut tog bort grenen refactor/split-billing 2026-10-18 19:12:26 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-18 19:12:27 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-18 22:21:53 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-18 22:34:45 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment!188
Ingen beskrivning angiven.