feat(reminders): mail the customer when a renewal fails #389

Sammanfogat
supernaut sammanfogade 3 incheckningar från feat/past-due-mail in i main 2026-10-13 10:35:39 +00:00
Ägare

What

Mail the customer once when a renewal fails. The renewal-reminder run now checks for past_due before the usual reminders. The mail gives the grace end date and links to the account page. Swedish and English.

How

  • duePastDue in src/lib/renewal-reminders.ts: past_due with a live graceEndsAt and a period end.
  • Dedupe reuses the claim table: key is (sub, currentPeriodEnd, threshold = -1). No migration, no new column. Existing reminder thresholds are 30, 7, 1, 0, so they never collide.
  • A failed send releases the claim, so the next run retries.
  • A failed renewal wins over the other reminders for that account in the same run.
  • No mail for active, canceled or incomplete subscriptions, or once the grace has ended.
  • pastDueNotice in src/i18n/emails.ts.

Copy

  • en: "We could not renew your Bitborg plan" / "We could not renew your Bitborg plan. You keep your plan through {date}." / "To keep your plan, email info@bitborg.se before then." / "Open your account"
  • sv: "Din plan hos Bitborg kunde inte förnyas" / "Vi kunde inte förnya din plan hos Bitborg. Du behåller din plan till och med {date}." / "Vill du behålla din plan, mejla info@bitborg.se före dess." / "Öppna kontosidan"

Tests

Branch, dedupe, later failed period, failed send, no mail for active or canceled, email copy, and a Postgres claim test for the new threshold.

Closes #388

## What Mail the customer once when a renewal fails. The renewal-reminder run now checks for `past_due` before the usual reminders. The mail gives the grace end date and links to the account page. Swedish and English. ## How - `duePastDue` in `src/lib/renewal-reminders.ts`: `past_due` with a live `graceEndsAt` and a period end. - Dedupe reuses the claim table: key is `(sub, currentPeriodEnd, threshold = -1)`. No migration, no new column. Existing reminder thresholds are 30, 7, 1, 0, so they never collide. - A failed send releases the claim, so the next run retries. - A failed renewal wins over the other reminders for that account in the same run. - No mail for active, canceled or incomplete subscriptions, or once the grace has ended. - `pastDueNotice` in `src/i18n/emails.ts`. ## Copy - en: "We could not renew your Bitborg plan" / "We could not renew your Bitborg plan. You keep your plan through {date}." / "To keep your plan, email info@bitborg.se before then." / "Open your account" - sv: "Din plan hos Bitborg kunde inte förnyas" / "Vi kunde inte förnya din plan hos Bitborg. Du behåller din plan till och med {date}." / "Vill du behålla din plan, mejla info@bitborg.se före dess." / "Öppna kontosidan" ## Tests Branch, dedupe, later failed period, failed send, no mail for active or canceled, email copy, and a Postgres claim test for the new threshold. Closes #388
supernaut lade till 2 incheckningar 2026-10-13 10:25:07 +00:00
Closes #388
chore(release): 1.39.0
Väntande kontroller
ci / ci (pull_request) Has started running
ad68b248be
supernaut lade till 1 incheckning 2026-10-13 10:28:50 +00:00
Merge remote-tracking branch 'origin/main' into feat/past-due-mail
Alla kontroller lyckades
ci / ci (pull_request) Successful in 6m22s
31d1457069
# Conflicts:
#	package.json
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-13 10:29:09 +00:00
supernaut sammanfogade incheckning 8b05982824 till main 2026-10-13 10:35:39 +00:00
supernaut tog bort grenen feat/past-due-mail 2026-10-13 10:35:39 +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-web!389
Ingen beskrivning angiven.