feat(account): show the plan's renewal date and how to cancel #283

Öppen
supernaut vill sammanfoga 3 incheckningar från s[2]s in i main
Ägare

What

On /account, a paid account (tier_pro) sees when its plan renews, or when it ends if cancelAtPeriodEnd is set. A hint line says to cancel by email to info@bitborg.se (from legalEntity.email). Swedish and English. Version 1.16.0.

Why

Launch minimum for the control panel. Cancellation is by email until self-service exists. Closes #279.

How

  • src/lib/renewal.ts: pure renewal(status, lang, now). Date is dateStyle: long, Europe/Stockholm, en-GB or sv-SE. "renews" only for status active without cancelAtPeriodEnd. "ends" for canceled or active with cancelAtPeriodEnd. Null for no period end, an unparsable or past period end, and other statuses such as past_due.
  • account-panel.astro: the status call is shared with the withdrawal offer (one billing request per render). Rendering is gated on billingConfigured() and isPaidAccount, like the other billing surfaces. A billing error is logged and the plan section renders without the date.
  • The cancel line shows only for a renewing subscription, or when the status call failed. It is hidden for a comped account (no subscription), an ending plan and past_due.
  • A billing failure is logged once per render.
  • Participant and trial accounts see neither line.

Tested

pnpm test 498 passed, 3 skipped. pnpm check 0 errors. pnpm lint clean. pnpm lang-check clean. New src/lib/renewal.test.ts covers locale format, cancel-at-period-end, canceled, past period end, past_due, Stockholm day boundary, null cases and renewsAutomatically. Not rendered in a browser.

Open questions

  • past_due shows no date and no cancel line until its own notice exists.

Dates: "renews on" shows the charge day (currentPeriodEnd + 1 ms, Europe/Stockholm). "Ends on" shows the last paid day (currentPeriodEnd). This matches the billing service treating currentPeriodEnd as the last instant of the paid period.

## What On `/account`, a paid account (`tier_pro`) sees when its plan renews, or when it ends if `cancelAtPeriodEnd` is set. A hint line says to cancel by email to info@bitborg.se (from `legalEntity.email`). Swedish and English. Version 1.16.0. ## Why Launch minimum for the control panel. Cancellation is by email until self-service exists. Closes #279. ## How - `src/lib/renewal.ts`: pure `renewal(status, lang, now)`. Date is `dateStyle: long`, Europe/Stockholm, `en-GB` or `sv-SE`. "renews" only for status `active` without `cancelAtPeriodEnd`. "ends" for `canceled` or active with `cancelAtPeriodEnd`. Null for no period end, an unparsable or past period end, and other statuses such as `past_due`. - `account-panel.astro`: the status call is shared with the withdrawal offer (one billing request per render). Rendering is gated on `billingConfigured()` and `isPaidAccount`, like the other billing surfaces. A billing error is logged and the plan section renders without the date. - The cancel line shows only for a renewing subscription, or when the status call failed. It is hidden for a comped account (no subscription), an ending plan and `past_due`. - A billing failure is logged once per render. - Participant and trial accounts see neither line. ## Tested `pnpm test` 498 passed, 3 skipped. `pnpm check` 0 errors. `pnpm lint` clean. `pnpm lang-check` clean. New `src/lib/renewal.test.ts` covers locale format, cancel-at-period-end, canceled, past period end, past_due, Stockholm day boundary, null cases and `renewsAutomatically`. Not rendered in a browser. ## Open questions - `past_due` shows no date and no cancel line until its own notice exists. Dates: "renews on" shows the charge day (`currentPeriodEnd` + 1 ms, Europe/Stockholm). "Ends on" shows the last paid day (`currentPeriodEnd`). This matches the billing service treating `currentPeriodEnd` as the last instant of the paid period.
supernaut lade till 3 incheckningar 2026-10-03 00:13:25 +00:00
A paid account now sees when its plan renews, or when it ends if cancelled at period end, from billing's subscription status. A line tells the user to cancel by email until self-service cancellation exists. Both are absent while billing is not configured, and a billing error leaves the page intact. The status call is shared with the withdrawal offer.

Closes #279
Billing also returns canceled and past_due subscriptions, and a comped account has no subscription. A canceled or cancel-at-period-end plan now reads as ending, a past period end or past_due says nothing, and the cancel line shows only for a renewing subscription or when billing could not be asked. A billing failure is logged once per render.

Refs #279
fix(account): date a renewal by the charge day
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m35s
3c3ec66d0f
Billing is moving currentPeriodEnd to the last instant of the paid period, 1 ms before the next charge day. A renewal is now dated by the charge day and an ending plan by its last paid day.

Refs #279
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m35s
Obligatorisk
Detaljer
Den här ändringsförfrågningen har ändringar som är i konflikt med målgrenen.
  • package.json
Visa kommandoradsinstruktioner

Manuell sammanfogningshjälp

Använd detta sammanfogningsmeddelande när sammanfogningen slutförs manuellt.

Checka ut

Checka ut en ny gren från din projektkatalog och testa ändringarna.
git fetch -u origin feat/279-renewal-date:feat/279-renewal-date
git switch feat/279-renewal-date
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!283
Ingen beskrivning angiven.