console: billing page prices follow the shown currency; upgrade links to a new account; copy in the map; actions in order (plans 6b task 8 review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+271
−52
internal/console/billingpage.go+32 −12internal/console/billingpage_copy.go+8 −0internal/console/billingpage_test.go+183 −1internal/console/server.go+3 −0internal/console/templates/billing.html+44 −39internal/console/templates/message.html+1 −0
diff --git a/internal/console/billingpage.go b/internal/console/billingpage.go| index 81152200a..957e493ba 100644 |
| --- a/internal/console/billingpage.go |
| +++ b/internal/console/billingpage.go |
| @@ -189,15 +189,20 @@ func currencyQuery(raw string, book *plans.PriceBook) (code string, refused bool |
| // billingView is the billing page's body. |
| type billingView struct { |
| + Eyebrow string |
| Notice, OwnersOnly, CurrencyNotice string |
| - Facts []string |
| - Offers billingOffers |
| - Buy *billingBuyView |
| - Change *billingChangeView |
| - StartOver []billingField // the open intent's own request, for Start over |
| + // Actions is decideBillingPage's Offered: the template renders each |
| + // offered action in this order. |
| + Actions []string |
| + Facts []string |
| + Offers billingOffers |
| + Buy *billingBuyView |
| + Change *billingChangeView |
| + StartOver []billingField // the open intent's own request, for Start over |
| } |
| -// billingOffers is decideBillingPage's Offered as the template reads it. |
| +// billingOffers is decideBillingPage's Offered as flags, for the parts of |
| +// the page that only ask whether an action is offered. |
| type billingOffers struct { |
| Buy, Change, Stop, Resume, Portal, Confirm, Continue, StartOver, MatchSeats bool |
| } |
| @@ -205,12 +210,18 @@ type billingOffers struct { |
| type billingField struct{ Name, Value string } |
| // billingBuyView is the first purchase: the paid plans, a quantity per |
| -// offered pack, and the currency (radios, or the account's fixed one). |
| +// offered pack, and the currency. Currency is the one every price is |
| +// rendered in, and the purchase form posts exactly it. The radios are a |
| +// separate GET form back to the page (PlanQuery carries a chosen paid |
| +// plan), so choosing a currency reloads the prices; an account's fixed |
| +// currency shows as text with no radios. |
| type billingBuyView struct { |
| Plans []billingPlanOption |
| Packs []billingPackInput |
| + Currency string |
| Currencies []billingCurrencyOption |
| FixedCurrency string |
| + PlanQuery string |
| } |
| type billingPlanOption struct { |
| @@ -281,17 +292,18 @@ func (s *Server) handleBilling(w http.ResponseWriter, r *http.Request) { |
| in, err := s.billingPageInputFor(acct, role, now) |
| if err != nil { |
| log.Printf("console: billing page %s: %v", acct.Sqid, err) |
| - s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read billing. Please try again.") |
| + s.renderMessage(w, r, http.StatusInternalServerError, billingCopy["error.title"], billingCopy["page.read_failed"]) |
| return |
| } |
| members, err := s.store.MemberCount(acct.ID) |
| if err != nil { |
| log.Printf("console: billing page %s: members: %v", acct.Sqid, err) |
| - s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read billing. Please try again.") |
| + s.renderMessage(w, r, http.StatusInternalServerError, billingCopy["error.title"], billingCopy["page.read_failed"]) |
| return |
| } |
| st := decideBillingPage(in) |
| view := s.billingViewFor(r, in, st, members) |
| + view.Eyebrow = fmt.Sprintf(billingCopy["page.eyebrow"], acct.Name) |
| p := s.accountPage(w, r, addr, raw, acct, role) |
| p.Title = billingCopy["page.title"] |
| p.ActiveNav = "billing" |
| @@ -302,7 +314,7 @@ func (s *Server) handleBilling(w http.ResponseWriter, r *http.Request) { |
| func (s *Server) billingViewFor(r *http.Request, in billingPageInput, st billingPageState, members int) *billingView { |
| cat, book := s.cfg.PlanCatalog, s.billing.cfg.Book |
| b := in.Billing |
| - v := &billingView{} |
| + v := &billingView{Actions: st.Offered} |
| switch st.Notice { |
| case "": |
| case "notice.ending": |
| @@ -419,7 +431,11 @@ func (s *Server) billingBuy(r *http.Request, book *plans.PriceBook, b *billingAc |
| } |
| } |
| + buy.Currency = display |
| want := r.URL.Query().Get("plan") |
| + if p, ok := cat.Plans[want]; ok && p.Paid { |
| + buy.PlanQuery = want |
| + } |
| seen := map[string]bool{} |
| for _, name := range paidPlansByTotal(cat, book, display) { |
| p := cat.Plans[name] |
| @@ -604,7 +620,7 @@ func (s *Server) handleUpgrade(w http.ResponseWriter, r *http.Request) { |
| accts, err := s.store.AccountsFor(addr) |
| if err != nil { |
| log.Printf("console: upgrade for %s: %v", addr, err) |
| - s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read your accounts. Please try again.") |
| + s.renderMessage(w, r, http.StatusInternalServerError, billingCopy["error.title"], billingCopy["upgrade.read_failed"]) |
| return |
| } |
| var owned []Account |
| @@ -615,7 +631,11 @@ func (s *Server) handleUpgrade(w http.ResponseWriter, r *http.Request) { |
| } |
| switch len(owned) { |
| case 0: |
| - s.renderMessage(w, r, http.StatusOK, billingCopy["upgrade.not_owner_title"], billingCopy["upgrade.not_owner"]) |
| + // renderMessage's page, plus Call 1's link to create an account. |
| + p := s.basePage(r) |
| + p.Title, p.Msg = billingCopy["upgrade.not_owner_title"], billingCopy["upgrade.not_owner"] |
| + p.MsgLink, p.MsgLinkText = "/accounts/new", billingCopy["upgrade.new_account"] |
| + s.render(w, http.StatusOK, "message", p) |
| case 1: |
| http.Redirect(w, r, withQuery("/a/"+url.PathEscape(owned[0].Sqid)+"/billing", kept), http.StatusSeeOther) |
| default: |
diff --git a/internal/console/billingpage_copy.go b/internal/console/billingpage_copy.go| index a3b62657c..81097f50d 100644 |
| --- a/internal/console/billingpage_copy.go |
| +++ b/internal/console/billingpage_copy.go |
| @@ -62,4 +62,12 @@ var billingCopy = map[string]string{ |
| "button.upgrade": "Upgrade to %s", |
| "button.stop": "Stop renewal", |
| "button.resume": "Turn renewal back on", |
| + // Review fix round 1: the currency form's button, the eyebrow, the |
| + // not-owner page's link and the read errors. |
| + "currency.show": "Show prices", |
| + "page.eyebrow": "Account · %s", |
| + "upgrade.new_account": "Create an account", |
| + "error.title": "Error", |
| + "page.read_failed": "Could not read billing. Please try again.", |
| + "upgrade.read_failed": "Could not read your accounts. Please try again.", |
| } |
diff --git a/internal/console/billingpage_test.go b/internal/console/billingpage_test.go| index f66e6c3bf..f0e93b1f1 100644 |
| --- a/internal/console/billingpage_test.go |
| +++ b/internal/console/billingpage_test.go |
| @@ -5,6 +5,7 @@ import ( |
| "net/http" |
| "net/http/httptest" |
| "net/url" |
| + "regexp" |
| "slices" |
| "strings" |
| "testing" |
| @@ -109,7 +110,9 @@ func TestDecideBillingPage(t *testing.T) { |
| "notice.checkout_open", "notice.collecting", "notice.ending", "notice.seat_drift", "notice.owners_only", |
| "currency.refused", "currency.refused_unshown", "currency.fixed", "buy.title", "buy.button", "team.price", |
| "team.members", "renews", "button.confirm", "button.continue", "button.start_over", "button.match_seats", |
| - "button.portal", "upgrade.not_owner_title", "upgrade.not_owner", "pick.title"} { |
| + "button.portal", "upgrade.not_owner_title", "upgrade.not_owner", "pick.title", |
| + // Task 8's own labels and messages (no wording outside the map). |
| + "page.eyebrow", "page.read_failed", "upgrade.read_failed", "error.title", "currency.show", "upgrade.new_account"} { |
| if billingCopy[k] == "" { |
| t.Errorf("billingCopy has no %q", k) |
| } |
| @@ -236,6 +239,9 @@ func TestBillingPageOffAndGate(t *testing.T) { |
| if status != http.StatusOK { |
| t.Fatalf("owner = %d", status) |
| } |
| + if want := esc(fmt.Sprintf(billingCopy["page.eyebrow"], pf.acct.Name)); !strings.Contains(body, want) { |
| + t.Errorf("the eyebrow %q is not the map's", want) |
| + } |
| for _, want := range []string{ |
| `action="/a/` + pf.acct.Sqid + `/billing/checkout"`, `name="csrf" value="` + pf.csrf + `"`, |
| `name="plan" value="personal"`, `name="plan" value="community"`, `name="plan" value="business"`, |
| @@ -612,6 +618,10 @@ func TestUpgradeEntry(t *testing.T) { |
| !strings.Contains(body, esc(billingCopy["upgrade.not_owner_title"])) { |
| t.Fatalf("owner of none = %d -> %q:\n%s", status, loc, body) |
| } |
| + // Call 1: with a link to create an account of their own. |
| + if !strings.Contains(body, `<a href="/accounts/new">`+esc(billingCopy["upgrade.new_account"])+`</a>`) { |
| + t.Fatalf("owner of none: no link to /accounts/new:\n%s", body) |
| + } |
| } |
| func TestUpgradeAfterSignupLandsOnBilling(t *testing.T) { |
| @@ -645,3 +655,175 @@ func TestUpgradeAfterSignupLandsOnBilling(t *testing.T) { |
| t.Fatalf("billing page = %d:\n%s", status, body) |
| } |
| } |
| + |
| +// ---- review fix round 1 ----------------------------------------------------- |
| + |
| +// htmlForm is the first form in body whose opening tag contains open, up |
| +// to its </form>; "" when there is none. |
| +func htmlForm(body, open string) string { |
| + i := strings.Index(body, open) |
| + if i < 0 { |
| + return "" |
| + } |
| + j := strings.Index(body[i:], "</form>") |
| + if j < 0 { |
| + return body[i:] |
| + } |
| + return body[i : i+j] |
| +} |
| + |
| +var ( |
| + currencyField = regexp.MustCompile(`<input type="([a-z]+)" name="currency" value="([^"]*)"`) |
| + hiddenField = regexp.MustCompile(`<input type="hidden" name="([^"]+)" value="([^"]*)"`) |
| +) |
| + |
| +// TestBillingPagePricesFollowShownCurrency: the purchase form submits the |
| +// currency its prices are rendered in, for an absent, sold or refused |
| +// query; the currency radios are their own GET form back to the page, so |
| +// choosing one reloads the prices, keeping the chosen plan. |
| +func TestBillingPagePricesFollowShownCurrency(t *testing.T) { |
| + pf := newBillingPageFixture(t) |
| + book := pf.srv.billing.cfg.Book |
| + buyOpen := `<form method="post" action="/a/` + pf.acct.Sqid + `/billing/checkout">` |
| + radiosOpen := `<form method="get" action="/a/` + pf.acct.Sqid + `/billing">` |
| + |
| + // check is the page at query: its purchase form posts priced, once, as |
| + // a hidden field, and shows personal's price in priced. |
| + check := func(t *testing.T, query, priced string) string { |
| + t.Helper() |
| + _, body := pf.page(t, query) |
| + buy := htmlForm(body, buyOpen) |
| + if buy == "" { |
| + t.Fatalf("?%s: no purchase form:\n%s", query, body) |
| + } |
| + fields := currencyField.FindAllStringSubmatch(buy, -1) |
| + if len(fields) != 1 || fields[0][1] != "hidden" || fields[0][2] != priced { |
| + t.Fatalf("?%s: the purchase form's currency fields = %q, want one hidden %q", query, fields, priced) |
| + } |
| + price, ok := book.PlanPrice("personal", priced) |
| + if !ok { |
| + t.Fatalf("no personal price in %s", priced) |
| + } |
| + if want := esc(fmt.Sprintf(billingCopy["plan.price"], plans.FormatMinor(priced, price))); !strings.Contains(buy, want) { |
| + t.Errorf("?%s: the purchase form is not priced in %s (%q):\n%s", query, priced, want, buy) |
| + } |
| + for _, other := range book.Currencies { |
| + if other == priced { |
| + continue |
| + } |
| + if p, ok := book.PlanPrice("personal", other); ok && strings.Contains(buy, esc(plans.FormatMinor(other, p))+" ") { |
| + t.Errorf("?%s: a %s price shows beside a %s purchase", query, other, priced) |
| + } |
| + } |
| + return body |
| + } |
| + for _, c := range []struct{ query, priced string }{ |
| + {"", book.DefaultCurrency}, // no country: the book's default |
| + {"currency=gbp", "gbp"}, |
| + {"currency=eur", "eur"}, |
| + {"currency=jpy", book.DefaultCurrency}, // refused: nothing preselected, priced as shown |
| + {"currency=" + url.QueryEscape("<script>"), book.DefaultCurrency}, |
| + {"currency=USD", book.DefaultCurrency}, |
| + } { |
| + t.Run(c.query, func(t *testing.T) { check(t, c.query, c.priced) }) |
| + } |
| + |
| + // The radios: a GET form to the page itself, a radio per sold |
| + // currency, its own button, and none of them inside the purchase form. |
| + body := check(t, "plan=community", book.DefaultCurrency) |
| + radios := htmlForm(body, radiosOpen) |
| + if radios == "" { |
| + t.Fatalf("no currency GET form %q:\n%s", radiosOpen, body) |
| + } |
| + for _, code := range book.Currencies { |
| + if !strings.Contains(radios, `<input type="radio" name="currency" value="`+code+`"`) { |
| + t.Errorf("the currency form has no %s radio", code) |
| + } |
| + } |
| + if !strings.Contains(radios, esc(billingCopy["currency.show"])) { |
| + t.Error("the currency form has no button") |
| + } |
| + if strings.Contains(htmlForm(body, buyOpen), `type="radio" name="currency"`) { |
| + t.Error("a currency radio sits inside the purchase form") |
| + } |
| + |
| + // Choosing gbp: submit the radio form as a browser would, its hidden |
| + // fields plus the chosen radio. The plan stays chosen and the prices |
| + // and the posted currency are gbp. |
| + q := url.Values{} |
| + for _, m := range hiddenField.FindAllStringSubmatch(radios, -1) { |
| + q.Add(m[1], m[2]) |
| + } |
| + if q.Get("plan") != "community" { |
| + t.Fatalf("the currency form drops the chosen plan: %v", q) |
| + } |
| + q.Set("currency", "gbp") |
| + body = check(t, q.Encode(), "gbp") |
| + if !strings.Contains(body, `name="plan" value="community" checked`) || !strings.Contains(body, `name="currency" value="gbp" checked`) { |
| + t.Errorf("after choosing gbp, community or gbp is not chosen:\n%s", body) |
| + } |
| + // A plan the catalog doesn't sell is not carried. |
| + _, body = pf.page(t, "plan="+url.QueryEscape("../x")) |
| + if strings.Contains(htmlForm(body, radiosOpen), `name="plan"`) { |
| + t.Error("the currency form carried an unknown plan") |
| + } |
| + |
| + // A fixed currency: text and the hidden field, no currency form. |
| + if err := pf.st.PutBillingState(billingAccount{AccountID: pf.acct.ID, Subscription: "sub_old", State: billing.StateEnded, |
| + Currency: "eur", PaidPacks: map[string]int{}}); err != nil { |
| + t.Fatal(err) |
| + } |
| + body = check(t, "currency=gbp", "eur") |
| + if htmlForm(body, radiosOpen) != "" { |
| + t.Error("a fixed currency still offers the currency form") |
| + } |
| +} |
| + |
| +// TestBillingPageActionsInOrder: the page renders the offered actions in |
| +// the decision's order (Change, Stop, Portal; Match seats first on drift). |
| +func TestBillingPageActionsInOrder(t *testing.T) { |
| + pf := newBillingPageFixture(t) |
| + if _, err := pf.st.SetAccountPlan(pf.acct.ID, "community", map[string]int{"apps": 2}, 12, PlanSourceBilling, nil, "billing", "billing", time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + paid := billingAccount{AccountID: pf.acct.ID, Customer: "cus_1", Subscription: "sub_1", State: billing.StatePaid, Live: true, |
| + Currency: "usd", PeriodEnd: periodEnd, Plan: "community", Seats: 12, PaidSeats: 12, PaidPacks: map[string]int{"apps": 2}} |
| + base := `/a/` + pf.acct.Sqid + `/billing/` |
| + marker := map[string]string{ |
| + offerConfirm: base + `confirm"`, offerContinue: base + `continue"`, offerStartOver: `name="start_over"`, |
| + offerMatchSeats: base + `seats"`, offerResume: `name="renewal" value="resume"`, offerChange: base + `change"`, |
| + offerStop: `name="renewal" value="stop"`, offerPortal: base + `portal"`, offerBuy: base + `checkout"`, |
| + } |
| + for _, c := range []struct { |
| + name string |
| + mod func(b *billingAccount) |
| + want []string |
| + }{ |
| + {"paid", nil, []string{offerChange, offerStop, offerPortal}}, |
| + {"seat drift", func(b *billingAccount) { b.SeatDriftAt, b.SeatDriftMembers = time.Now(), 10 }, |
| + []string{offerMatchSeats, offerChange, offerStop, offerPortal}}, |
| + {"ending", func(b *billingAccount) { b.CancelAtPeriodEnd = true }, []string{offerResume, offerPortal}}, |
| + } { |
| + t.Run(c.name, func(t *testing.T) { |
| + b := paid |
| + if c.mod != nil { |
| + c.mod(&b) |
| + } |
| + if err := pf.st.PutBillingState(b); err != nil { |
| + t.Fatal(err) |
| + } |
| + _, body := pf.page(t, "") |
| + last := -1 |
| + for _, k := range c.want { |
| + i := strings.Index(body, marker[k]) |
| + if i < 0 { |
| + t.Fatalf("%s is not offered:\n%s", k, body) |
| + } |
| + if i < last { |
| + t.Errorf("%s renders before the action the decision puts ahead of it (order %v)", k, c.want) |
| + } |
| + last = i |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/console/server.go b/internal/console/server.go| index 866a20fcd..16e08975a 100644 |
| --- a/internal/console/server.go |
| +++ b/internal/console/server.go |
| @@ -1960,6 +1960,9 @@ type page struct { |
| InvitePlaceholder, InviteNote string |
| Msg string // generic message page body |
| + // MsgLink is an optional link the message page offers under Msg, with |
| + // MsgLinkText its words ("" for none; /upgrade's not-owner page). |
| + MsgLink, MsgLinkText string |
| Flash string // one-shot success notice (cookie-carried across a redirect) |
| // PlanNotices are the account's plan warnings (plans 4a), one banner |
diff --git a/internal/console/templates/billing.html b/internal/console/templates/billing.html| index 1c37c14ea..01308d4b4 100644 |
| --- a/internal/console/templates/billing.html |
| +++ b/internal/console/templates/billing.html |
| @@ -2,7 +2,7 @@ |
| {{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}} |
| {{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}} |
| <div class="pagehead"> |
| - <p class="eyebrow">Account · {{.Account.Name}}</p> |
| + <p class="eyebrow">{{.Billing.Eyebrow}}</p> |
| <h1>{{billingText "page.title"}}</h1> |
| </div> |
| {{with .Billing}} |
| @@ -13,37 +13,42 @@ |
| {{range .Facts}}<li>{{.}}</li> |
| {{end}} |
| </ul> |
| -<div class="settings-row"> |
| - {{if .Offers.Confirm}}<form method="post" action="{{$.Base}}/billing/confirm"> |
| - <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| - <button type="submit">{{billingText "button.confirm"}}</button> |
| - </form>{{end}} |
| - {{if .Offers.Continue}}<form method="get" action="{{$.Base}}/billing/continue"> |
| - <button type="submit">{{billingText "button.continue"}}</button> |
| - </form>{{end}} |
| - {{if .Offers.StartOver}}<form method="post" action="{{$.Base}}/billing/checkout"> |
| - <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| - {{range .StartOver}}<input type="hidden" name="{{.Name}}" value="{{.Value}}"> |
| - {{end}}<button class="linkish" type="submit">{{billingText "button.start_over"}}</button> |
| - </form>{{end}} |
| - {{if .Offers.MatchSeats}}<form method="post" action="{{$.Base}}/billing/seats"> |
| - <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| - <button type="submit">{{billingText "button.match_seats"}}</button> |
| - </form>{{end}} |
| - {{if .Offers.Resume}}<form method="post" action="{{$.Base}}/billing/renewal"> |
| - <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| - <input type="hidden" name="renewal" value="resume"> |
| - <button type="submit">{{billingText "button.resume"}}</button> |
| - </form>{{end}} |
| - {{if .Offers.Portal}}<form method="post" action="{{$.Base}}/billing/portal"> |
| - <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| - <button type="submit">{{billingText "button.portal"}}</button> |
| - </form>{{end}} |
| -</div> |
| -{{with .Buy}} |
| +{{/* The offered actions, in decideBillingPage's order. */}} |
| +{{range .Actions}} |
| +{{if eq . "confirm"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/confirm"> |
| + <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| + <button type="submit">{{billingText "button.confirm"}}</button> |
| +</form></div>{{end}} |
| +{{if eq . "continue"}}<div class="settings-row"><form method="get" action="{{$.Base}}/billing/continue"> |
| + <button type="submit">{{billingText "button.continue"}}</button> |
| +</form></div>{{end}} |
| +{{if eq . "start_over"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/checkout"> |
| + <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| + {{range $.Billing.StartOver}}<input type="hidden" name="{{.Name}}" value="{{.Value}}"> |
| + {{end}}<button class="linkish" type="submit">{{billingText "button.start_over"}}</button> |
| +</form></div>{{end}} |
| +{{if eq . "match_seats"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/seats"> |
| + <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| + <button type="submit">{{billingText "button.match_seats"}}</button> |
| +</form></div>{{end}} |
| +{{if eq . "resume"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/renewal"> |
| + <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| + <input type="hidden" name="renewal" value="resume"> |
| + <button type="submit">{{billingText "button.resume"}}</button> |
| +</form></div>{{end}} |
| +{{if eq . "buy"}}{{with $.Billing.Buy}} |
| <h2>{{billingText "buy.title"}}</h2> |
| +{{if .FixedCurrency}}<p>{{.FixedCurrency}}</p> |
| +{{else}}<form method="get" action="{{$.Base}}/billing"> |
| + {{if .PlanQuery}}<input type="hidden" name="plan" value="{{.PlanQuery}}">{{end}} |
| + <p>{{billingText "currency.legend"}}: |
| + {{range .Currencies}}<label><input type="radio" name="currency" value="{{.Code}}"{{if .Checked}} checked{{end}}> {{.Code}}</label> |
| + {{end}}<button class="linkish" type="submit">{{billingText "currency.show"}}</button> |
| + </p> |
| +</form>{{end}} |
| <form method="post" action="{{$.Base}}/billing/checkout"> |
| <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| + <input type="hidden" name="currency" value="{{.Currency}}"> |
| {{range .Plans}}<p> |
| <label><input type="radio" name="plan" value="{{.Name}}"{{if .Checked}} checked{{end}} required> {{.Label}}</label> |
| <span class="small">{{.Price}}{{if .Total}} {{.Total}}{{end}}</span> |
| @@ -59,15 +64,10 @@ |
| {{end}} |
| </table> |
| </div> |
| - {{if .FixedCurrency}}<p>{{.FixedCurrency}}<input type="hidden" name="currency" value="{{.FixedCurrency}}"></p> |
| - {{else}}<p>{{billingText "currency.legend"}}: |
| - {{range .Currencies}}<label><input type="radio" name="currency" value="{{.Code}}"{{if .Checked}} checked{{end}} required> {{.Code}}</label> |
| - {{end}} |
| - </p>{{end}} |
| <button type="submit">{{billingText "buy.button"}}</button> |
| </form> |
| -{{end}} |
| -{{with .Change}} |
| +{{end}}{{end}} |
| +{{if eq . "change"}}{{with $.Billing.Change}} |
| <div class="tablewrap"> |
| <table> |
| {{range .Packs}}<tr> |
| @@ -91,11 +91,16 @@ |
| </form> |
| {{end}} |
| </div>{{end}} |
| -{{end}} |
| -{{if .Offers.Stop}}<form method="post" action="{{$.Base}}/billing/renewal"> |
| +{{end}}{{end}} |
| +{{if eq . "stop"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/renewal"> |
| <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| <input type="hidden" name="renewal" value="stop"> |
| <button class="linkish danger" type="submit">{{billingText "button.stop"}}</button> |
| -</form>{{end}} |
| +</form></div>{{end}} |
| +{{if eq . "portal"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/portal"> |
| + <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| + <button type="submit">{{billingText "button.portal"}}</button> |
| +</form></div>{{end}} |
| +{{end}} |
| {{end}} |
| {{template "bottom" .}}{{end}} |
diff --git a/internal/console/templates/message.html b/internal/console/templates/message.html| index 69ec75d07..149c6261d 100644 |
| --- a/internal/console/templates/message.html |
| +++ b/internal/console/templates/message.html |
| @@ -1,5 +1,6 @@ |
| {{define "message"}}{{template "top" .}} |
| <h1>{{.Title}}</h1> |
| <p>{{.Msg}}</p> |
| +{{if .MsgLink}}<p><a href="{{.MsgLink}}">{{.MsgLinkText}}</a></p>{{end}} |
| <p class="small"><a href="/">Back to the console</a></p> |
| {{template "bottom" .}}{{end}} |