Public: anyone can read this; the crew can change it.
/pricing says in one line what happens when a plan lapses (the grace, then paused, never deleted), from the same constant the lapse uses #15667
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15644-pricing-says-in-one-line-what-happens-wh → main 0 commits fork
5 files
changed +46
−2
docs/features/pricing-lapse-line.md added +12
| @@ -0,0 +1,12 @@ | ||
| 1 | --- | |
| 2 | topic: When something is wrong | |
| 3 | row: What happens when a plan lapses, said on /pricing | |
| 4 | --- | |
| 5 | # What happens when a plan lapses, said on /pricing | |
| 6 | ||
| 7 | `/pricing`, the page you land on after paying (`/pricing/done`) and the terminal's **Get a forge** screen all say the same sentence (#15644): "If a payment lapses, you have 7 days of grace. After that your forge sleeps and keeps its data." | |
| 8 | ||
| 9 | - The number of days is the `billing.grace_days` setting (`/admin/limits`), the one the lapse code reads. Change it and all three change. | |
| 10 | - Web: under the steps after "After you pay", and in small print under the claim link on the confirmation. | |
| 11 | - Terminal: after the after-payment steps, where a checkout is connected. | |
| 12 | - `/terms` says how long the data is kept after that. |
src/tui/screens/pricing.ts +2 −1
| @@ -11,6 +11,7 @@ | ||
| 11 | 11 | |
| 12 | 12 | import { deliverLink, mayView, NO_PROVIDER, placeOrder, reconcileOrder } from "../../actions/order.ts"; |
| 13 | 13 | import { AFTER_PAYMENT_STEPS, priceLine } from "../../billing/plan_words.ts"; |
| 14 | import { lapseRule, lapseRuleWords } from "../../billing/lapse_rule.ts"; | |
| 14 | 15 | import { checkoutOf } from "../../billing/checkout.ts"; |
| 15 | 16 | import { publicOrigin } from "../../core/public_origin.ts"; |
| 16 | 17 | import { bucketOf } from "../../http/peer.ts"; |
| @@ -167,7 +168,7 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 167 | 168 | } |
| 168 | 169 | if (selling) { |
| 169 | 170 | next++; |
| 170 | for (const step of AFTER_PAYMENT_STEPS) | |
| 171 | for (const step of [...AFTER_PAYMENT_STEPS, lapseRuleWords(lapseRule(f.app.db))]) | |
| 171 | 172 | for (const part of wrap(step, fw)) { |
| 172 | 173 | if (next < area.h) s.text(area.x, area.y + next, part, style(c.mutedFg, c.bg), area.x + area.w); |
| 173 | 174 | next++; |
src/web/pages/pricing.ts +1 −1
| @@ -182,7 +182,7 @@ async function doneView(ctx: Ctx): Promise<Response> { | ||
| 182 | 182 | const o = await reconcileOrder(ctx.app, id); |
| 183 | 183 | if (o === undefined) return notFoundPage(ctx); |
| 184 | 184 | const plain = (title: string, body: Html, status = 200): Response => { |
| 185 | const res = page({ ctx, title, body: html`<div class="narrow-wide" data-order="${o.state}">${pageHead(title)}<section class="settings-block">${body}</section></div>` }, status); | |
| 185 | const res = page({ ctx, title, body: html`<div class="narrow-wide" data-order="${o.state}">${pageHead(title)}<section class="settings-block">${body}</section>${o.state === "failed" ? null : html`<p class="muted small" data-lapse="sleep">${lapseRuleWords(lapseRule(ctx.app.db))}</p>`}</div>` }, status); | |
| 186 | 186 | res.headers.set("cache-control", "no-store"); |
| 187 | 187 | return res; |
| 188 | 188 | }; |
test/pricing-order.test.ts +23
| @@ -301,3 +301,26 @@ describe("/pricing: abuse and lifetimes", () => { | ||
| 301 | 301 | expect(placed).toBe(before + 1); |
| 302 | 302 | }); |
| 303 | 303 | }); |
| 304 | ||
| 305 | describe("/pricing lapse line", () => { | |
| 306 | test("the lapse line follows billing.grace_days on /pricing and on the paid confirmation, plainly", async () => { | |
| 307 | useCheckout(app, fake); | |
| 308 | const days = limitValue(app.db, "billing.grace_days"); | |
| 309 | const placed = await placeOrder(app, { name: "lapsey", plan: "small", email: "[email protected]", address: "203.0.113.77" }, new URL(`${base}/pricing/order`)); | |
| 310 | if (!placed.ok) throw new Error("order"); | |
| 311 | const cookie = `forge_order=${placed.value.id}.${placed.value.ticket}`; | |
| 312 | const order = getOrder(app.db, placed.value.id)!; | |
| 313 | await settleSession(app, completed({ id: order.id, session_id: order.sessionId })); | |
| 314 | made.push("lapsey"); | |
| 315 | expect(getOrder(app.db, order!.id)?.state).toBe("spawned"); | |
| 316 | for (const n of [days, 11]) { | |
| 317 | setLimit(app.db, "billing.grace_days", n, admin.id); | |
| 318 | const words = `you have ${n} ${n === 1 ? "day" : "days"} of grace. After that your forge sleeps and keeps its data.`; | |
| 319 | expect(await (await fetch(`${base}/pricing`)).text()).toContain(words); | |
| 320 | const done = await (await fetch(`${base}/pricing/done?order=${order!.id}`, { headers: { cookie } })).text(); | |
| 321 | expect(done).toContain(words); | |
| 322 | expect(done.toLowerCase()).not.toContain("dunning"); | |
| 323 | } | |
| 324 | setLimit(app.db, "billing.grace_days", days, admin.id); | |
| 325 | }); | |
| 326 | }); |
test/tui-pricing.test.ts +8
| @@ -303,6 +303,14 @@ test("the form shows each after-payment step whole, as the page does (#13262)", | ||
| 303 | 303 | for (const step of AFTER_PAYMENT_STEPS) expect(text).toContain(step); |
| 304 | 304 | }); |
| 305 | 305 | |
| 306 | test("the form says the lapse rule from billing.grace_days, as the page does (#15644)", async () => { | |
| 307 | const { lapseRule, lapseRuleWords } = await import("../src/billing/lapse_rule.ts"); | |
| 308 | const f = await fixture(); | |
| 309 | const h = f.open("203.0.113.41"); | |
| 310 | await settleApp(h.tui); | |
| 311 | expect(flat(h)).toContain(lapseRuleWords(lapseRule(f.app.db))); | |
| 312 | }); | |
| 313 | ||
| 306 | 314 | test("with no provider the form shows none of the after-payment steps (#13262)", async () => { |
| 307 | 315 | const { AFTER_PAYMENT_STEPS } = await import("../src/billing/plan_words.ts"); |
| 308 | 316 | const f = await fixture({ sell: false }); |
new above
offline