fix(billing): count the renewal grace in calendar days #179

Sammanfogat
supernaut sammanfogade 3 incheckningar från fix/grace-calendar-days in i main 2026-10-13 19:18:30 +00:00
Ägare

Grace in calendar days (#155)

The renewal grace was periodEnd + 8 * 24h. A day across the spring clock change is 23 hours, so a period ending around 22 to 28 March got a grace that ended at 00:59:59.999 the next day. The portal showed the wrong date and access ended almost an hour late.

  • New renewalGraceEnd(periodEnd): Amsterdam midnight of the eighth day after the period end's day, minus 1 ms.
  • graceEndsAt in subscriptionStatus and the sweep's isDue share it.
  • The grace length is unchanged: 8 days.

Tests

  • New unit test: a period ending 25 March 2027 has its grace end at the end of 2 April, not on 3 April. It also covers the October change and a summer case with no clock change.
  • The Postgres grace tests use the helper instead of a hard-coded 8 * DAY.

Release

Version 0.16.0. This is the last PR of the batch: merge #178 first. Squash-merge, so the intermediate 0.15.1 commit does not land.

Closes #155

## Grace in calendar days (#155) The renewal grace was `periodEnd + 8 * 24h`. A day across the spring clock change is 23 hours, so a period ending around 22 to 28 March got a grace that ended at 00:59:59.999 the next day. The portal showed the wrong date and access ended almost an hour late. - New `renewalGraceEnd(periodEnd)`: Amsterdam midnight of the eighth day after the period end's day, minus 1 ms. - `graceEndsAt` in `subscriptionStatus` and the sweep's `isDue` share it. - The grace length is unchanged: 8 days. ## Tests - New unit test: a period ending 25 March 2027 has its grace end at the end of 2 April, not on 3 April. It also covers the October change and a summer case with no clock change. - The Postgres grace tests use the helper instead of a hard-coded `8 * DAY`. ## Release Version 0.16.0. This is the last PR of the batch: merge #178 first. Squash-merge, so the intermediate 0.15.1 commit does not land. Closes #155
supernaut lade till 3 incheckningar 2026-10-13 18:12:33 +00:00
A day across a clock change is not 24 hours, so a grace of 8 * 24 hours
ended almost an hour late after the spring change. The status and the
sweep now share one helper that ends the grace at Amsterdam midnight.

Closes #155
chore(release): 0.16.0
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m8s
399dbebd60
supernaut tvångsskickade fix/grace-calendar-days från 399dbebd60
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m8s
till c7e6841106
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m19s
2026-10-13 19:15:38 +00:00
Jämför
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-13 19:16:07 +00:00
supernaut sammanfogade incheckning 83f6f32b70 till main 2026-10-13 19:18:30 +00:00
supernaut tog bort grenen fix/grace-calendar-days 2026-10-13 19:18:30 +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!179
Ingen beskrivning angiven.