Title a displaced subscription paused once Stripe confirms its collection pause
Fifth section of #269's change. The operator's Not delivering badge now reads the pause Stripe confirmed: a displaced subscription whose recorded pause_collection behavior is set, and whose every holder is a grant, is titled "Billing paused while a grant holds {ladders}." ("grants hold" when several grant provisions hold them). An organization with several subscriptions reads "Billing paused on {k} of {n} subscriptions while ...", followed, when some are not paused, by the existing "Billing continues on {m} while ..." sentence. The record decides "paused", never the rule: a subscription whose pause Stripe has not confirmed keeps the existing title. The organization page and the subscriptions list both read the column section 2 added. The Issue grant warning reads "Products marked ⚠ would supersede a tier a subscription pays for; its billing pauses until the grant ends." docs/stripe.md and docs/plan-management.md name the paused title and the existing one while the pause is unconfirmed. Tests: TestDisplacementTitle rows for the paused, mixed and holder forms, the mixed form in both input orders; TestDisplacedOnPage rows for a recorded pause, a Dashboard pause and a pause under a subscription holder; TestSubscriptionTitlesFor's paused row; TestSubscriptionsListMarksAPausedSubscription; the golden state grant-over-subscription-paused, which differs from grant-over-subscription only in the badge's title. The three goldens that show the warning change only in its sentence. The Dashboard-pause row records mark_uncollectible rather than the test kit's void, because displacedOnPage sees only the behavior and a void row would repeat the recorded-pause row. Review: no blocker or major. Three minors and five nits applied: five comments that still said a displaced subscription bills, a row that could not test a recorded pause under a purchase, the second input order, and a narrower failure text for the warning's break. Breaks: 9 of 9 caught. Full suite on reset databases: 4783 pass, 14 skip. make screens: no change beyond the three captures every run since section 2 redraws. The tasks expected the Issue grant captures to change; none shows the warning, because the captured organization's one subscription holds no tier, so item 5.9 now says so.
This commit is contained in:
@@ -154,14 +154,14 @@ An operator can issue a grant to move a pool to a specific tier:
|
||||
|
||||
1. Open the organization's page from the **Organizations** list.
|
||||
2. In the **Grants** section, click **Issue grant**. The panel opens with a stacked form: one field per row, each label above its field.
|
||||
3. Choose a **Product**, optionally a **Quantity** and a **Valid until** timestamp, choose a **Reason**, and optionally add a **Note**. A product whose grant would supersede a tier a subscription holds, active or suspended, is marked ⚠ in the **Product** list, and the form's warning says that the subscription keeps billing and delivers nothing on that ladder until the grant ends.
|
||||
3. Choose a **Product**, optionally a **Quantity** and a **Valid until** timestamp, choose a **Reason**, and optionally add a **Note**. A product whose grant would supersede a tier a subscription holds, active or suspended, is marked ⚠ in the **Product** list, and the form's warning says that the subscription's billing pauses until the grant ends.
|
||||
4. Tick **Resumes**, whose label sits above its box, when the grant should deliver again after a plan bought or granted over it ends (see [Grants that resume](#grants-that-resume)). It starts unticked, and it is offered for every product, including the organization type's default product.
|
||||
5. Click **Issue grant**.
|
||||
|
||||
The system:
|
||||
- Creates a grant with the chosen reason and the resumption mark, then calls the conferral boundary (`internal/entitlements/conferral.go`) through the operator handler in `internal/server/operator_enrollment.go`: it writes the grant decree, confers the position onto the organization's default pool, then materializes the organization's effective entitlements
|
||||
- Registers a **Temporal workflow** to expire the grant at `valid_until` when one is set
|
||||
- Keeps the ladder for a grant that supersedes a tier a subscription pays for: the subscription delivers nothing there while the grant lasts, and the console pauses its collection at Stripe, and the organization page's Billing card and the subscription's row in the operator's subscriptions list carry a **Not delivering** badge whose title reads "Billing continues while a grant holds {ladder}."; the subscription delivers again at its next reconcile after the grant ends
|
||||
- Keeps the ladder for a grant that supersedes a tier a subscription pays for: the subscription delivers nothing there while the grant lasts, and the console pauses its collection at Stripe, and the organization page's Billing card and the subscription's row in the operator's subscriptions list carry a **Not delivering** badge whose title reads "Billing paused while a grant holds {ladder}." once Stripe confirms the pause ("grants hold" when several grants hold the ladders) and "Billing continues while a grant holds {ladder}." until it does; the subscription delivers again at its next reconcile after the grant ends
|
||||
|
||||
While Temporal is not connected, which on a deployment without
|
||||
`temporal-host` is always, a grant with **Valid until** is refused before
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ A member moves between the paid tiers of a plan ladder on the Products page, and
|
||||
- **Cancellation.** Every paid plan offers **Cancel plan** on its card. Access continues until the end of the paid period (`cancel_at_period_end`), after which the organization moves to its type's default plan, when one is configured, or leaves the ladder.
|
||||
- **Taking a scheduled move back.** While a downgrade or a cancellation is scheduled, the plan's card offers **Keep plan**, which releases the schedule or clears `cancel_at_period_end` at no charge. While a downgrade is scheduled, **Cancel plan** follows it and replaces the downgrade; while a cancellation is scheduled, **Keep plan** is the only control.
|
||||
- **A plan whose payment is due.** A subscription Stripe holds as `past_due` or `unpaid` keeps its card on the Products page, shown as the current plan with its state, while its entitlements are suspended. No switch is offered in either direction and a posted one is refused before any Stripe call, because a switch would invoice while the failed invoice is still open. **Keep plan** and **Cancel plan** at the period end work as on an active plan. A posted immediate cancellation is refused, because Stripe's immediate cancellation stops automatic collection of the customer's finalized invoices, and a **Keep plan** over a downgrade that Stripe has already applied is refused, because there is nothing left to take back. The unpaid invoice stays due after a cancellation: once the cancellation takes effect, Stripe stops retrying that subscription's open invoice and leaves the customer's other subscriptions collecting, so the member pays it through the invoice's **Pay invoice**. A paused subscription shows its state and is refused every act; only a subscription made outside the console reaches `paused`, which follows a trial that ends without a payment method, because the console's Checkout creates no trial.
|
||||
- **A grant over a paid plan.** An operator's grant over a tier a subscription pays for keeps the ladder until it ends or is revoked, and the subscription delivers nothing there. The console pauses the subscription's collection at Stripe (`pause_collection` with `behavior=void`, and the marker `member_console_collection=paused_for_grant` in the subscription's metadata) within seconds, through the outbox, and sets no `resumes_at`. Each renewal Stripe makes while the grant holds is a draft for about an hour and is then voided, so nothing is charged. When the grant ends, the console clears the pause and the marker, and the tier is delivered again; no money moves at either edge. While the grant holds the ladder, the organization page's Billing card and the subscription's row in the operator's subscriptions list carry a **Not delivering** badge, whose title reads "Billing continues while a grant holds {ladder}." Once only the organization type's default holds the ladder, or nothing does, the subscription's next reconcile delivers its tier again. A new purchase over a grant still replaces the grant. What this accepts until the exact money rule (#280): the renewal date decides which way a grant that is not whole periods falls, because a period's renewal is voided or charged whole; a pause landing after a renewal's finalization lets that renewal be charged, and a clear landing before the finalization of a renewal made while paused lets it be charged; a pause or clear that lands late moves a whole period one way or the other, and a void cannot be undone; the first charge after a grant can come without Stripe's upcoming-renewal reminder. A subscription item with no entitlement set, such as a donation line added in the Dashboard, stops billing with the tier beside it while the pause holds. An invoice open before the grant stays due: Stripe keeps retrying it, and the account's dunning setting can cancel the paused subscription.
|
||||
- **A grant over a paid plan.** An operator's grant over a tier a subscription pays for keeps the ladder until it ends or is revoked, and the subscription delivers nothing there. The console pauses the subscription's collection at Stripe (`pause_collection` with `behavior=void`, and the marker `member_console_collection=paused_for_grant` in the subscription's metadata) within seconds, through the outbox, and sets no `resumes_at`. Each renewal Stripe makes while the grant holds is a draft for about an hour and is then voided, so nothing is charged. When the grant ends, the console clears the pause and the marker, and the tier is delivered again; no money moves at either edge. While the grant holds the ladder, the organization page's Billing card and the subscription's row in the operator's subscriptions list carry a **Not delivering** badge. Once Stripe confirms the pause, which the subscription row records, its title reads "Billing paused while a grant holds {ladder}." ("grants hold" when several grants hold the ladders); until it does, and while the pause has failed, it reads "Billing continues while a grant holds {ladder}." Once only the organization type's default holds the ladder, or nothing does, the subscription's next reconcile delivers its tier again. A new purchase over a grant still replaces the grant. What this accepts until the exact money rule (#280): the renewal date decides which way a grant that is not whole periods falls, because a period's renewal is voided or charged whole; a pause landing after a renewal's finalization lets that renewal be charged, and a clear landing before the finalization of a renewal made while paused lets it be charged; a pause or clear that lands late moves a whole period one way or the other, and a void cannot be undone; the first charge after a grant can come without Stripe's upcoming-renewal reminder. A subscription item with no entitlement set, such as a donation line added in the Dashboard, stops billing with the tier beside it while the pause holds. An invoice open before the grant stays due: Stripe keeps retrying it, and the account's dunning setting can cancel the paused subscription.
|
||||
- **Pay invoice.** The card of a plan whose payment is due, and the detail of an open invoice, link to Stripe's hosted invoice page. The console reads the page's URL from Stripe when the member opens the link and redirects there; it never stores or logs the URL, which is a bearer link, and it needs no key permission beyond the reads of subscriptions and invoices that the reconciles already make. Paying there makes the new card the customer's default for invoices but leaves the subscription's own default on the card that failed, which Stripe charges first, so the next renewal charges the failed card again. Stripe's page still takes payment for an invoice Stripe has marked uncollectible, which the console shows as open until the invoice sweep reads it again.
|
||||
|
||||
A restricted key needs permission for the calls these moves make, beyond those the console already uses: `POST /v1/subscription_schedules`, `POST /v1/subscription_schedules/{id}`, `POST /v1/subscription_schedules/{id}/release` and `POST /v1/invoices/{id}/void`. The console also updates a subscription with `POST /v1/subscriptions/{id}` to set `pause_collection` while a grant holds its ladder and to clear it when the grant no longer does, which is the Subscriptions write the plan moves already need. Stripe names the missing permission in the error a key without it receives.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
The organization is the row's subject and leads as the row header
|
||||
(chrome-conventions); cancel-at-period-end is an exception marker
|
||||
beside the status, and so is the Not delivering badge of a subscription
|
||||
that bills while another plan holds its ladder (DisplacementTitle); one
|
||||
that delivers nothing while another plan holds its ladder (DisplacementTitle); one
|
||||
danger line above the table says the read for it failed
|
||||
(DisplacementError); the always-"Default" billing account name and the
|
||||
truncated ID column are retired (maintainer, 2026-08-30); a
|
||||
|
||||
@@ -190,8 +190,9 @@ var badgeMap = map[string]Badge{
|
||||
"trialing": {Label: "Trialing", Tone: "info"},
|
||||
"past_due": {Label: "Past due", Tone: "danger"},
|
||||
"paused": {Label: "Paused", Tone: "secondary"},
|
||||
// A subscription that keeps billing while another plan holds one of its
|
||||
// ladders (displaced-subscription-waits D4); its title says which.
|
||||
// A subscription that delivers nothing while another plan holds one of its
|
||||
// ladders (displaced-subscription-waits D4); its title says which, and
|
||||
// whether its billing is paused (grant-pauses-subscription-billing D16).
|
||||
"not_delivering": {Label: "Not delivering", Tone: "warning"},
|
||||
// The subscription's own unpaid state, as loud as its past-due state.
|
||||
"subscription_unpaid": {Label: "Unpaid", Tone: "danger"},
|
||||
|
||||
@@ -642,7 +642,7 @@ func (h *OperatorPartialsHandler) subscriptionDisplacementTitles(ctx context.Con
|
||||
func subscriptionTitlesFor(subs []billing.ListSubscriptionsPageRow, items []billing.ListCurrentSubscriptionItemsBySubscriptionIDsRow, shapes []entitlements.ListConferralShapesRow, rows []entitlements.ListSubscriptionDisplacementsBySubscriptionIDsRow) map[string]string {
|
||||
refs := make([]subscriptionRef, len(subs))
|
||||
for i, s := range subs {
|
||||
refs[i] = subscriptionRef{ID: s.SubscriptionID, Status: s.Status}
|
||||
refs[i] = subscriptionRef{ID: s.SubscriptionID, Status: s.Status, PauseBehavior: s.PauseCollectionBehavior.String}
|
||||
}
|
||||
converted := make([]entitlements.ListAccountSubscriptionDisplacementsRow, len(rows))
|
||||
for i, r := range rows {
|
||||
|
||||
@@ -309,8 +309,8 @@ var grantReasonDomain = []string{"manual", "evaluation", "promotional", "complim
|
||||
// IssuanceProductOption is one selectable product on the single issuance form
|
||||
// (Doc 41: one form over all published products). Internal wrap products
|
||||
// (is_public=false) render with an "internal" badge; SupersedesSubscription
|
||||
// flags a product whose position would displace a subscription-held rung (the
|
||||
// subscription keeps billing — §11.2 residue), surfaced as a non-blocking
|
||||
// flags a product whose position would displace a subscription-held rung (its
|
||||
// billing pauses until the grant ends, Copy row W), surfaced as a non-blocking
|
||||
// advisory.
|
||||
type IssuanceProductOption struct {
|
||||
ProductID string
|
||||
@@ -480,20 +480,28 @@ type displacedHolder struct {
|
||||
}
|
||||
|
||||
// displacedSubscription is one subscription's displaced ladders and the
|
||||
// positions that hold them.
|
||||
// positions that hold them. Paused is true when the subscription's recorded
|
||||
// state has a collection pause and every position that holds one of its
|
||||
// displaced ladders is a grant (design D16).
|
||||
type displacedSubscription struct {
|
||||
Ladders []displacedLadder
|
||||
Holders []displacedHolder
|
||||
Paused bool
|
||||
}
|
||||
|
||||
// displacedOnPage applies the reconcile's rule to a subscription's current
|
||||
// products: every product is taken as missing (a product with a live
|
||||
// provision is on no displaced ladder, design D2), and the ladder of each
|
||||
// displacement the rule picks is named. A displacement whose ladder no
|
||||
// current product names produces nothing. It reads no row.
|
||||
func displacedOnPage(products []string, rungs map[string][]entitlements.Rung, displacements []entitlements.Displacement) displacedSubscription {
|
||||
// current product names produces nothing. pauseBehavior is the subscription
|
||||
// row's recorded pause behavior, empty when none is recorded; the subscription
|
||||
// reads as paused when it is set and every displacement picked is held by a
|
||||
// grant. The record decides "paused", never the rule: a pause Stripe has not
|
||||
// confirmed does not read as one. It reads no row.
|
||||
func displacedOnPage(products []string, rungs map[string][]entitlements.Rung, displacements []entitlements.Displacement, pauseBehavior string) displacedSubscription {
|
||||
left := entitlements.DisplacedProducts(products, rungs, displacements)
|
||||
var out displacedSubscription
|
||||
grantsOnly := true
|
||||
for _, p := range products {
|
||||
d, ok := left[p]
|
||||
if !ok {
|
||||
@@ -501,58 +509,125 @@ func displacedOnPage(products []string, rungs map[string][]entitlements.Rung, di
|
||||
}
|
||||
out.Ladders = append(out.Ladders, displacedLadder{ID: d.LadderID, Name: d.LadderName})
|
||||
out.Holders = append(out.Holders, displacedHolder{ProvisionID: d.HolderProvisionID, Source: d.HolderSource})
|
||||
grantsOnly = grantsOnly && d.HolderSource == "grant"
|
||||
}
|
||||
out.Paused = len(out.Ladders) > 0 && pauseBehavior != "" && grantsOnly
|
||||
return out
|
||||
}
|
||||
|
||||
// displacementTitle builds the Not delivering badge's title (Copy row O2): ""
|
||||
// when nothing is displaced, "Billing continues while <holder> <ladders>." for
|
||||
// an account of one subscription, and "Billing continues on <k> of <n>
|
||||
// subscriptions while <holder> <ladders>." otherwise. The ladders are the
|
||||
// distinct displaced ladders by id, sorted by name, whatever order they
|
||||
// arrive in; the holder is worded by source when one provision holds every
|
||||
// ladder. It reads no row.
|
||||
func displacementTitle(subscriptions int, displaced []displacedSubscription) string {
|
||||
var ladders []displacedLadder
|
||||
var holders []displacedHolder
|
||||
// titleGroup is the distinct ladders and holders of the displaced
|
||||
// subscriptions of one kind, with how many subscriptions there are.
|
||||
type titleGroup struct {
|
||||
count int
|
||||
ladders []displacedLadder
|
||||
holders []displacedHolder
|
||||
}
|
||||
|
||||
// groupDisplaced collects the displaced subscriptions whose Paused equals
|
||||
// paused. The ladders are distinct by id and sorted by name, then id.
|
||||
func groupDisplaced(displaced []displacedSubscription, paused bool) titleGroup {
|
||||
var g titleGroup
|
||||
seenLadder := make(map[string]bool)
|
||||
seenHolder := make(map[string]bool)
|
||||
count := 0
|
||||
for _, d := range displaced {
|
||||
if len(d.Ladders) == 0 {
|
||||
if len(d.Ladders) == 0 || d.Paused != paused {
|
||||
continue
|
||||
}
|
||||
count++
|
||||
g.count++
|
||||
for _, l := range d.Ladders {
|
||||
if !seenLadder[l.ID] {
|
||||
seenLadder[l.ID] = true
|
||||
ladders = append(ladders, l)
|
||||
g.ladders = append(g.ladders, l)
|
||||
}
|
||||
}
|
||||
for _, h := range d.Holders {
|
||||
if !seenHolder[h.ProvisionID] {
|
||||
seenHolder[h.ProvisionID] = true
|
||||
holders = append(holders, h)
|
||||
g.holders = append(g.holders, h)
|
||||
}
|
||||
}
|
||||
}
|
||||
if count == 0 {
|
||||
return ""
|
||||
}
|
||||
slices.SortFunc(ladders, func(a, b displacedLadder) int {
|
||||
slices.SortFunc(g.ladders, func(a, b displacedLadder) int {
|
||||
if c := strings.Compare(a.Name, b.Name); c != 0 {
|
||||
return c
|
||||
}
|
||||
return strings.Compare(a.ID, b.ID)
|
||||
})
|
||||
names := make([]string, len(ladders))
|
||||
for i, l := range ladders {
|
||||
return g
|
||||
}
|
||||
|
||||
// names returns the group's ladder names, joined for a sentence.
|
||||
func (g titleGroup) names() string {
|
||||
names := make([]string, len(g.ladders))
|
||||
for i, l := range g.ladders {
|
||||
names[i] = l.Name
|
||||
}
|
||||
return joinWithAnd(names)
|
||||
}
|
||||
|
||||
// pausedSentence is the sentence of Copy rows O0 and O1 for the group;
|
||||
// subscriptions is the account's count.
|
||||
func (g titleGroup) pausedSentence(subscriptions int) string {
|
||||
holder := pausedHolder(g.holders)
|
||||
if subscriptions == 1 {
|
||||
return "Billing continues while " + displacementHolder(holders) + " " + joinWithAnd(names) + "."
|
||||
return "Billing paused while " + holder + " " + g.names() + "."
|
||||
}
|
||||
return fmt.Sprintf("Billing continues on %d of %d subscriptions while %s %s.", count, subscriptions, displacementHolder(holders), joinWithAnd(names))
|
||||
return fmt.Sprintf("Billing paused on %d of %d subscriptions while %s %s.", g.count, subscriptions, holder, g.names())
|
||||
}
|
||||
|
||||
// continuingSentence is the existing sentence for the group that keeps
|
||||
// billing: alone it is the whole title, after a paused sentence (Copy row O2)
|
||||
// it counts only its own subscriptions.
|
||||
func (g titleGroup) continuingSentence(subscriptions int, afterPaused bool) string {
|
||||
holder := displacementHolder(g.holders)
|
||||
switch {
|
||||
case subscriptions == 1:
|
||||
return "Billing continues while " + holder + " " + g.names() + "."
|
||||
case afterPaused:
|
||||
return fmt.Sprintf("Billing continues on %d while %s %s.", g.count, holder, g.names())
|
||||
}
|
||||
return fmt.Sprintf("Billing continues on %d of %d subscriptions while %s %s.", g.count, subscriptions, holder, g.names())
|
||||
}
|
||||
|
||||
// displacementTitle builds the Not delivering badge's title (Copy rows O0 to
|
||||
// O2 and the existing forms): "" when nothing is displaced. It splits the
|
||||
// displaced subscriptions into paused and not, builds each part's ladders and
|
||||
// holder, and joins the paused sentence and the continuing sentence with one
|
||||
// space. The three forms, for an account of one subscription ("while" without
|
||||
// a count) and of several:
|
||||
//
|
||||
// Billing paused while <grant holder> <ladders>.
|
||||
// Billing paused on <k> of <n> subscriptions while <grant holder> <ladders>.
|
||||
// Billing paused on <k> of <n> subscriptions while <grant holder> <ladders>. Billing continues on <m> while <holder> <ladders>.
|
||||
//
|
||||
// and, with nothing paused, the existing "Billing continues while <holder>
|
||||
// <ladders>." and "Billing continues on <k> of <n> subscriptions while
|
||||
// <holder> <ladders>.". A paused sentence's holder is "a grant holds" when one
|
||||
// grant provision holds every ladder it names and "grants hold" when several
|
||||
// do, counted by provision (displacementHolder counts the same way). The
|
||||
// recorded pause, never the rule, decides "paused" (displacedOnPage). It reads
|
||||
// no row.
|
||||
func displacementTitle(subscriptions int, displaced []displacedSubscription) string {
|
||||
paused := groupDisplaced(displaced, true)
|
||||
continuing := groupDisplaced(displaced, false)
|
||||
var sentences []string
|
||||
if paused.count > 0 {
|
||||
sentences = append(sentences, paused.pausedSentence(subscriptions))
|
||||
}
|
||||
if continuing.count > 0 {
|
||||
sentences = append(sentences, continuing.continuingSentence(subscriptions, paused.count > 0))
|
||||
}
|
||||
return strings.Join(sentences, " ")
|
||||
}
|
||||
|
||||
// pausedHolder words the holders of a paused subscription's displaced
|
||||
// ladders, which are all grants: "a grant holds" for one provision, "grants
|
||||
// hold" for several.
|
||||
func pausedHolder(holders []displacedHolder) string {
|
||||
if len(holders) == 1 {
|
||||
return "a grant holds"
|
||||
}
|
||||
return "grants hold"
|
||||
}
|
||||
|
||||
// displacementHolder words the holders of the displaced ladders: by source
|
||||
@@ -1801,6 +1876,9 @@ func (h *OperatorPartialsHandler) accountDisplacementTitle(r *http.Request, acco
|
||||
type subscriptionRef struct {
|
||||
ID string
|
||||
Status string
|
||||
// PauseBehavior is the row's recorded collection pause behavior, empty
|
||||
// when Stripe reported none.
|
||||
PauseBehavior string
|
||||
}
|
||||
|
||||
// displacedByID applies the reconcile's rule to each subscription whose
|
||||
@@ -1814,7 +1892,7 @@ func displacedByID(subs []subscriptionRef, products map[string][]string, rungs m
|
||||
if !subscriptionMayBeDisplaced(s.Status) {
|
||||
continue
|
||||
}
|
||||
if d := displacedOnPage(products[s.ID], rungs, displacements[s.ID]); len(d.Ladders) > 0 {
|
||||
if d := displacedOnPage(products[s.ID], rungs, displacements[s.ID], s.PauseBehavior); len(d.Ladders) > 0 {
|
||||
out[s.ID] = d
|
||||
}
|
||||
}
|
||||
@@ -1860,7 +1938,7 @@ func productsBySubscription[R itemRow](items []R) map[string][]string {
|
||||
func displacementTitleFor(subs []billing.Subscription, items []billing.ListCurrentSubscriptionItemsByBillingAccountIDRow, shapes []entitlements.ListConferralShapesRow, rows []entitlements.ListAccountSubscriptionDisplacementsRow) string {
|
||||
refs := make([]subscriptionRef, len(subs))
|
||||
for i, s := range subs {
|
||||
refs[i] = subscriptionRef{ID: s.SubscriptionID, Status: s.Status}
|
||||
refs[i] = subscriptionRef{ID: s.SubscriptionID, Status: s.Status, PauseBehavior: s.PauseCollectionBehavior.String}
|
||||
}
|
||||
byID := displacedByID(refs, productsBySubscription(items), entitlements.RungsByProduct(shapes), displacementsBySubscription(rows))
|
||||
var displaced []displacedSubscription
|
||||
@@ -2077,11 +2155,9 @@ func (h *OperatorPartialsHandler) productsOnLadders(r *http.Request, ladders map
|
||||
// subscriptionHeldLadders returns the set of plan ladders currently occupied by
|
||||
// a subscription-sourced provision, active or suspended, on any of the org's
|
||||
// pools. The issuance form uses it to advise (non-blocking) when a grant would
|
||||
// supersede a subscription-held rung — the subscription keeps billing (§11.2
|
||||
// residue). Pure read; best-effort: a pool whose positions fail to read is
|
||||
// supersede a subscription-held rung. Pure read; best-effort: a pool whose positions fail to read is
|
||||
// skipped, not surfaced. A suspended position is held: core.confer supersedes
|
||||
// it as it does an active one, and the subscription keeps billing in Stripe,
|
||||
// or bills again once a paused one resumes.
|
||||
// it as it does an active one.
|
||||
func (h *OperatorPartialsHandler) subscriptionHeldLadders(r *http.Request, pools []entitlements.ResourcePool) map[string]bool {
|
||||
held := map[string]bool{}
|
||||
for _, pool := range pools {
|
||||
|
||||
@@ -130,8 +130,12 @@ const issueGrantLead = "A tier product moves the pool to that tier, up or down."
|
||||
// issueGrantSupersedeWarning follows the lead when a product the select
|
||||
// offers is marked with the supersession marker. The sentence states what the
|
||||
// grant does to the subscription and names no view, because the operator's
|
||||
// billing views only read (displaced-subscription-waits D4, Copy row O5).
|
||||
const issueGrantSupersedeWarning = "Products marked ⚠ would supersede a tier a subscription pays for; the subscription keeps billing and delivers nothing on that ladder until the grant ends."
|
||||
// billing views only read (displaced-subscription-waits D4). The sentence is
|
||||
// grant-pauses-subscription-billing Copy row W. The grant pauses the subscription's
|
||||
// billing because the console pauses collection at Stripe while a grant holds
|
||||
// every ladder the subscription pays for, so the subscription is not charged
|
||||
// for a period the grant covers.
|
||||
const issueGrantSupersedeWarning = "Products marked ⚠ would supersede a tier a subscription pays for; its billing pauses until the grant ends."
|
||||
|
||||
// manageGrantForm is the declaration for Manage (grant-resumption D15):
|
||||
// everything about a grant that can change after issue, with the fields the
|
||||
|
||||
@@ -222,6 +222,13 @@ func newEnrollmentFixture(t *testing.T) *enrollmentFixture {
|
||||
f.grant("Small2", w.Issue(o, small2, world.IssueOpts{}))
|
||||
add("grant-over-subscription", o.ID, "")
|
||||
|
||||
o = f.org("grant-over-subscription-paused", plain)
|
||||
sub = w.Subscribe(o, world.SubOpts{PeriodEnd: noon(2099, time.January, 15)}, small2)
|
||||
f.norm.Name("subscription", "grant-over-paused", sub.ID)
|
||||
w.PauseCollection(sub)
|
||||
f.grant("Small2", w.Issue(o, small2, world.IssueOpts{}))
|
||||
add("grant-over-subscription-paused", o.ID, "")
|
||||
|
||||
lite2 := f.product("Lite2")
|
||||
f.ladder("Cycle", lite2)
|
||||
o = f.org("many-changes", plain)
|
||||
|
||||
@@ -501,6 +501,10 @@ func TestOrgEnrollmentIssueGrantPanel_TerseCopy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// supersedeWarningCopy is Copy row W of grant-pauses-subscription-billing, the
|
||||
// whole sentence the Issue grant form's warning reads.
|
||||
const supersedeWarningCopy = "Products marked ⚠ would supersede a tier a subscription pays for; its billing pauses until the grant ends."
|
||||
|
||||
// TestOrgEnrollmentIssueGrantPanel_Stacked covers grant-resumption D21:
|
||||
// Issue grant is a stacked form in its panel, the form part's own box at the
|
||||
// readable measure, one field per row with its label above, the lead above
|
||||
@@ -549,8 +553,9 @@ func TestOrgEnrollmentIssueGrantPanel_Stacked(t *testing.T) {
|
||||
data.IssuanceProducts = append(data.IssuanceProducts, IssuanceProductOption{ProductID: "prod-pro", Name: "Pro", SupersedesSubscription: true})
|
||||
data.IssueGrantForm = issueGrantFormView(data.OrgID, data.IssuanceProducts, forms.ModeRecord, forms.NewValues(), nil, "")
|
||||
warned := renderOrgEnrollment(t, data)
|
||||
if !strings.Contains(warned, `A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; the subscription keeps billing and delivers nothing on that ladder until the grant ends.</div>`) {
|
||||
t.Errorf("the supersession warning does not follow the lead:\n%s", warned)
|
||||
wantWarning := `A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">` + supersedeWarningCopy + `</div>`
|
||||
if !strings.Contains(warned, wantWarning) {
|
||||
t.Errorf("the stacked Issue grant panel lacks %q:\n%s", wantWarning, warned)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,8 +705,8 @@ func TestOrgEnrollmentProductsSection(t *testing.T) {
|
||||
if !strings.Contains(out, "Standard Plan ⚠") {
|
||||
t.Error("expected the ⚠ marker on superseding product options")
|
||||
}
|
||||
if !strings.Contains(out, "supersede a tier a subscription pays for") {
|
||||
t.Error("expected the supersession advisory when a ⚠ option is present")
|
||||
if !strings.Contains(out, ">"+supersedeWarningCopy+"<") {
|
||||
t.Errorf("the products section lacks the supersession warning %q when a ⚠ option is present", supersedeWarningCopy)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1292,6 +1297,13 @@ func displacedOn(holder displacedHolder, ladders ...displacedLadder) displacedSu
|
||||
return d
|
||||
}
|
||||
|
||||
// pausedOn is displacedOn for a subscription whose pause is recorded.
|
||||
func pausedOn(holder displacedHolder, ladders ...displacedLadder) displacedSubscription {
|
||||
d := displacedOn(holder, ladders...)
|
||||
d.Paused = true
|
||||
return d
|
||||
}
|
||||
|
||||
type displacementTitleRow struct {
|
||||
name string
|
||||
subscriptions int
|
||||
@@ -1303,6 +1315,8 @@ func displacementTitleRows() []displacementTitleRow {
|
||||
hosting := displacedLadder{ID: "l-hosting", Name: "Hosting"}
|
||||
support := displacedLadder{ID: "l-support", Name: "Support"}
|
||||
docs := displacedLadder{ID: "l-docs", Name: "Docs"}
|
||||
wiki := displacedLadder{ID: "l-wiki", Name: "Wiki"}
|
||||
demoLadder := displacedLadder{ID: "l-demo", Name: "Demo Ladder"}
|
||||
grant := displacedHolder{ProvisionID: "p-grant", Source: "grant"}
|
||||
other := displacedHolder{ProvisionID: "p-other", Source: "grant"}
|
||||
sub := displacedHolder{ProvisionID: "p-sub", Source: "subscription"}
|
||||
@@ -1326,11 +1340,36 @@ func displacementTitleRows() []displacementTitleRow {
|
||||
displacedOn(grant, hosting), displacedOn(grant, hosting),
|
||||
}, "Billing continues on 2 of 3 subscriptions while a grant holds Hosting."},
|
||||
{"nothing displaced", 2, nil, ""},
|
||||
{"one subscription, paused", 1, []displacedSubscription{pausedOn(grant, demoLadder)}, "Billing paused while a grant holds Demo Ladder."},
|
||||
{"one subscription, pause not confirmed", 1, []displacedSubscription{displacedOn(grant, demoLadder)}, "Billing continues while a grant holds Demo Ladder."},
|
||||
{"three subscriptions, two paused", 3, []displacedSubscription{
|
||||
pausedOn(grant, hosting), pausedOn(grant, hosting),
|
||||
}, "Billing paused on 2 of 3 subscriptions while a grant holds Hosting."},
|
||||
{"three subscriptions, one paused, one continuing under another subscription", 3, []displacedSubscription{
|
||||
pausedOn(grant, hosting), displacedOn(sub, wiki),
|
||||
}, "Billing paused on 1 of 3 subscriptions while a grant holds Hosting. Billing continues on 1 while another subscription holds Wiki."},
|
||||
{"three subscriptions, the continuing one listed first", 3, []displacedSubscription{
|
||||
displacedOn(sub, wiki), pausedOn(grant, hosting),
|
||||
}, "Billing paused on 1 of 3 subscriptions while a grant holds Hosting. Billing continues on 1 while another subscription holds Wiki."},
|
||||
{"one subscription, paused under two grants", 1, []displacedSubscription{{
|
||||
Ladders: []displacedLadder{hosting, wiki},
|
||||
Holders: []displacedHolder{grant, other},
|
||||
Paused: true,
|
||||
}}, "Billing paused while grants hold Hosting and Wiki."},
|
||||
{"one subscription, paused under one bundle grant on two ladders", 1, []displacedSubscription{pausedOn(grant, hosting, wiki)}, "Billing paused while a grant holds Hosting and Wiki."},
|
||||
{"three subscriptions, two paused under two grants", 3, []displacedSubscription{
|
||||
pausedOn(grant, hosting), pausedOn(other, wiki),
|
||||
}, "Billing paused on 2 of 3 subscriptions while grants hold Hosting and Wiki."},
|
||||
{"paused but held by a purchase", 1, []displacedSubscription{displacedOnPage([]string{"tier"},
|
||||
map[string][]entitlements.Rung{"tier": {{LadderID: "l-hosting", Rank: 1}}},
|
||||
[]entitlements.Displacement{{LadderID: "l-hosting", LadderName: "Hosting", HolderProvisionID: "p-purchase", HolderSource: "purchase"}},
|
||||
"void")}, "Billing continues while another plan holds Hosting."},
|
||||
}
|
||||
}
|
||||
|
||||
// TestDisplacementTitle compares every form of the Not delivering badge's
|
||||
// title (displaced-subscription-waits, Copy row O2) with its whole sentence.
|
||||
// title (displaced-subscription-waits Copy row O2, grant-pauses-subscription-billing
|
||||
// Copy rows O0 to O2) with its whole sentence.
|
||||
func TestDisplacementTitle(t *testing.T) {
|
||||
for _, tc := range displacementTitleRows() {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
@@ -1343,6 +1382,7 @@ func TestDisplacementTitle(t *testing.T) {
|
||||
|
||||
type displacedOnPageRow struct {
|
||||
name string
|
||||
behavior string
|
||||
products []string
|
||||
rungs map[string][]entitlements.Rung
|
||||
displacements []entitlements.Displacement
|
||||
@@ -1356,22 +1396,34 @@ func displacedOnPageRows() []displacedOnPageRow {
|
||||
hosting := displacedLadder{ID: "l-hosting", Name: "Hosting"}
|
||||
grant := displacedHolder{ProvisionID: "p-grant", Source: "grant"}
|
||||
return []displacedOnPageRow{
|
||||
{"a displacement on a ladder a current product names",
|
||||
{"a displacement on a ladder a current product names", "",
|
||||
[]string{"tier"}, map[string][]entitlements.Rung{"tier": {{LadderID: "l-hosting", Rank: 1}}},
|
||||
[]entitlements.Displacement{held("l-hosting", "Hosting")},
|
||||
displacedSubscription{Ladders: []displacedLadder{hosting}, Holders: []displacedHolder{grant}}},
|
||||
{"the item moved off the ladder",
|
||||
{"the item moved off the ladder", "",
|
||||
[]string{"other"}, map[string][]entitlements.Rung{"other": {{LadderID: "l-support", Rank: 1}}},
|
||||
[]entitlements.Displacement{held("l-hosting", "Hosting")},
|
||||
displacedSubscription{}},
|
||||
{"the item removed",
|
||||
{"the item removed", "",
|
||||
nil, map[string][]entitlements.Rung{"tier": {{LadderID: "l-hosting", Rank: 1}}},
|
||||
[]entitlements.Displacement{held("l-hosting", "Hosting")},
|
||||
displacedSubscription{}},
|
||||
{"a bundle displaced on one ladder",
|
||||
{"a bundle displaced on one ladder", "",
|
||||
[]string{"bundle"}, map[string][]entitlements.Rung{"bundle": {{LadderID: "l-hosting", Rank: 1}, {LadderID: "l-support", Rank: 1}}},
|
||||
[]entitlements.Displacement{held("l-support", "Support")},
|
||||
displacedSubscription{Ladders: []displacedLadder{{ID: "l-support", Name: "Support"}}, Holders: []displacedHolder{grant}}},
|
||||
{"a recorded pause under grants", "void",
|
||||
[]string{"tier"}, map[string][]entitlements.Rung{"tier": {{LadderID: "l-hosting", Rank: 1}}},
|
||||
[]entitlements.Displacement{held("l-hosting", "Hosting")},
|
||||
displacedSubscription{Ladders: []displacedLadder{hosting}, Holders: []displacedHolder{grant}, Paused: true}},
|
||||
{"a recorded foreign pause under grants", "mark_uncollectible",
|
||||
[]string{"tier"}, map[string][]entitlements.Rung{"tier": {{LadderID: "l-hosting", Rank: 1}}},
|
||||
[]entitlements.Displacement{held("l-hosting", "Hosting")},
|
||||
displacedSubscription{Ladders: []displacedLadder{hosting}, Holders: []displacedHolder{grant}, Paused: true}},
|
||||
{"a recorded pause under a subscription", "void",
|
||||
[]string{"tier"}, map[string][]entitlements.Rung{"tier": {{LadderID: "l-hosting", Rank: 1}}},
|
||||
[]entitlements.Displacement{{LadderID: "l-hosting", LadderName: "Hosting", HolderProvisionID: "p-sub", HolderSource: "subscription"}},
|
||||
displacedSubscription{Ladders: []displacedLadder{hosting}, Holders: []displacedHolder{{ProvisionID: "p-sub", Source: "subscription"}}}},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1381,7 +1433,7 @@ func displacedOnPageRows() []displacedOnPageRow {
|
||||
func TestDisplacedOnPage(t *testing.T) {
|
||||
for _, tc := range displacedOnPageRows() {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if got := displacedOnPage(tc.products, tc.rungs, tc.displacements); !reflect.DeepEqual(got, tc.want) {
|
||||
if got := displacedOnPage(tc.products, tc.rungs, tc.displacements, tc.behavior); !reflect.DeepEqual(got, tc.want) {
|
||||
t.Errorf("displacedOnPage(%s) = %+v, want %+v", tc.name, got, tc.want)
|
||||
}
|
||||
})
|
||||
@@ -1480,6 +1532,11 @@ func subscriptionTitlesRows() []subscriptionTitlesRow {
|
||||
sub := func(id, status string) billing.ListSubscriptionsPageRow {
|
||||
return billing.ListSubscriptionsPageRow{SubscriptionID: id, Status: status}
|
||||
}
|
||||
paused := func(id string) billing.ListSubscriptionsPageRow {
|
||||
row := sub(id, "active")
|
||||
row.PauseCollectionBehavior = sql.NullString{String: "void", Valid: true}
|
||||
return row
|
||||
}
|
||||
hosting, docs := displacementTitleForLadder, displacementTitleForLadder2
|
||||
return []subscriptionTitlesRow{
|
||||
{"a canceled subscription has no badge", []billing.ListSubscriptionsPageRow{sub("s1", "canceled")},
|
||||
@@ -1491,6 +1548,13 @@ func subscriptionTitlesRows() []subscriptionTitlesRow {
|
||||
"s1": "Billing continues while a grant holds Hosting.",
|
||||
"s2": "Billing continues while another subscription holds Docs.",
|
||||
}},
|
||||
{"a paused row", []billing.ListSubscriptionsPageRow{paused("s1"), sub("s2", "active")},
|
||||
[]entitlements.ListSubscriptionDisplacementsBySubscriptionIDsRow{
|
||||
displaced("s1", hosting, "Hosting", "grant"), displaced("s2", docs, "Docs", "grant"),
|
||||
}, map[string]string{
|
||||
"s1": "Billing paused while a grant holds Hosting.",
|
||||
"s2": "Billing continues while a grant holds Docs.",
|
||||
}},
|
||||
{"a delivering row has no badge", []billing.ListSubscriptionsPageRow{sub("s1", "active"), sub("s2", "active")},
|
||||
[]entitlements.ListSubscriptionDisplacementsBySubscriptionIDsRow{displaced("s1", hosting, "Hosting", "grant")},
|
||||
map[string]string{"s1": "Billing continues while a grant holds Hosting."}},
|
||||
|
||||
@@ -21,6 +21,7 @@ type displacedListFixture struct {
|
||||
orgA, orgB world.Org
|
||||
subA, subB world.Subscription
|
||||
title string
|
||||
ladder string
|
||||
}
|
||||
|
||||
// newDisplacedListFixture builds the state the grant-over-subscription
|
||||
@@ -39,6 +40,7 @@ func newDisplacedListFixture(t *testing.T) displacedListFixture {
|
||||
f.subA = w.Subscribe(f.orgA, world.SubOpts{}, small)
|
||||
w.MapSubscription(f.subA)
|
||||
w.Issue(f.orgA, small, world.IssueOpts{})
|
||||
f.ladder = box.Name
|
||||
f.title = "Billing continues while a grant holds " + box.Name + "."
|
||||
|
||||
f.orgB = w.Org("Delivering", w.OrgType("boxb"), w.Person("Owner B"))
|
||||
@@ -100,6 +102,26 @@ func TestSubscriptionsListMarksADisplacedSubscription(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSubscriptionsListMarksAPausedSubscription pins that a displaced
|
||||
// subscription whose row records a collection pause reads Copy row O0 in the
|
||||
// list, and one without the record keeps the existing title.
|
||||
func TestSubscriptionsListMarksAPausedSubscription(t *testing.T) {
|
||||
f := newDisplacedListFixture(t)
|
||||
wantContinuing := f.title
|
||||
wantPaused := "Billing paused while a grant holds " + f.ladder + "."
|
||||
|
||||
before, _ := f.list(t, catalogReadsConfig(f.w))
|
||||
if got, _ := titleOf(before, f.subA.ID); got != wantContinuing {
|
||||
t.Errorf("subscriptions list title = %q, want %q", got, wantContinuing)
|
||||
}
|
||||
|
||||
f.w.PauseCollection(f.subA)
|
||||
after, _ := f.list(t, catalogReadsConfig(f.w))
|
||||
if got, _ := titleOf(after, f.subA.ID); got != wantPaused {
|
||||
t.Errorf("subscriptions list title = %q, want %q", got, wantPaused)
|
||||
}
|
||||
}
|
||||
|
||||
type subscriptionsListReadFailure struct {
|
||||
name, querier, method string
|
||||
}
|
||||
|
||||
@@ -0,0 +1,523 @@
|
||||
|
||||
|
||||
<div class="d-flex align-items-start justify-content-between gap-3 mb-3 app-page-header">
|
||||
<div class="app-page-header-text">
|
||||
<nav aria-label="breadcrumb"><ol class="breadcrumb small mb-1">
|
||||
<li class="breadcrumb-item"><a href="/operator">Operator</a></li><li class="breadcrumb-item"><a href="/operator/organizations">Organizations</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">grant-over-subscription-paused</li>
|
||||
</ol></nav>
|
||||
<h1 class="h2 mb-0">grant-over-subscription-paused</h1>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-sm-3">Owner</dt>
|
||||
<dd class="col-sm-9">
|
||||
|
||||
<a href="/operator/persons/<person:Ann>">Ann</a>
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between gap-3 mt-4 mb-2 app-section-header">
|
||||
<h2 class="h5 mb-0">Billing</h2>
|
||||
|
||||
<a href="/operator/billing/accounts?q=grant-over-subscription-paused+" class="btn btn-sm btn-outline-secondary">Full billing</a>
|
||||
</div>
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="row g-3">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="text-muted small">Outstanding balance</div>
|
||||
|
||||
<div>0.00</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="text-muted small">Subscriptions</div>
|
||||
|
||||
<div>
|
||||
<span class="badge text-bg-success">Active</span>
|
||||
<span class="badge text-bg-warning" title="Billing paused while a grant holds Box.">Not delivering<span class="visually-hidden">, Billing paused while a grant holds Box.</span></span>
|
||||
<a href="/operator/billing/subscriptions?q=grant-over-subscription-paused+">1 subscription</a>
|
||||
|
||||
<small class="text-muted">· renews Jan 15, 2099</small>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="text-muted small">Latest invoice</div>
|
||||
|
||||
<div class="text-muted small">No invoices issued</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between gap-3 mt-4 mb-2 app-section-header">
|
||||
<h2 class="h5 mb-0">Pools <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Pools" data-bs-content="A pool holds what an organization's plan and grants deliver; its sites and services draw from it." aria-label="Help: Pools"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button></h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-start">
|
||||
<div>
|
||||
<h3 class="h6 mb-1">
|
||||
Default <span class="badge text-bg-success">Active</span>
|
||||
</h3>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-2">
|
||||
<p class="mb-0"><strong>Small2</strong></p>
|
||||
<p class="mb-0 small text-muted">
|
||||
<span title="since <today> <hh:mm>">Box, rank 0</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between gap-3 mt-4 mb-2 app-section-header">
|
||||
<h2 class="h5 mb-0">Grants</h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="plan-grants-panel">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header d-flex justify-content-between align-items-center gap-2">
|
||||
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
|
||||
<li class="nav-item"><a class="nav-link active" href="/operator/organizations/<org:grant-over-subscription-paused>" hx-get="/operator/organizations/<org:grant-over-subscription-paused>" hx-target="#plan-grants-panel" hx-select="#plan-grants-panel" hx-select-oob="#tier-changes-panel,#entitlement-changes-panel" hx-swap="outerHTML" hx-push-url="true">Active</a></li>
|
||||
|
||||
<li class="nav-item"><a class="nav-link " href="/operator/organizations/<org:grant-over-subscription-paused>?tab=history" hx-get="/operator/organizations/<org:grant-over-subscription-paused>?tab=history" hx-target="#plan-grants-panel" hx-select="#plan-grants-panel" hx-select-oob="#tier-changes-panel,#entitlement-changes-panel" hx-swap="outerHTML" hx-push-url="true">History</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="flex-shrink-0">
|
||||
|
||||
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" data-bs-toggle="collapse" data-bs-target="#issueGrantPanel" aria-expanded="false" aria-controls="issueGrantPanel"><svg class="app-opener-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true" focusable="false"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>Issue grant</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="collapse" id="issueGrantPanel">
|
||||
|
||||
|
||||
<div class="card app-form-box mb-3"><div class="card-body">
|
||||
<form id="form-operator.enrollment.grant.issue" data-form="operator.enrollment.grant.issue" data-form-kind="create" class="app-form" novalidate hx-post="/partials/operator/organizations/<org:grant-over-subscription-paused>/grant/create" hx-target="#operator-body" hx-swap="innerHTML" hx-disable="find button[type=submit]" hx-indicator="find .htmx-indicator">
|
||||
<div id="form-operator.enrollment.grant.issue-error" class="app-form-error" role="alert"></div>
|
||||
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.</div>
|
||||
|
||||
|
||||
|
||||
<div class="app-form-fields">
|
||||
<div id="form-operator.enrollment.grant.issue-product_id" class="mb-3 app-form-field">
|
||||
|
||||
|
||||
<label class="form-label" for="form-operator.enrollment.grant.issue-product_id-control">Product</label>
|
||||
|
||||
<select class="form-select" id="form-operator.enrollment.grant.issue-product_id-control" name="product_id" required aria-describedby="form-operator.enrollment.grant.issue-product_id-warning" hx-get="/partials/operator/products/rule-check" hx-swap="innerHTML" hx-target="#form-operator\.enrollment\.grant\.issue-product_id-warning" hx-trigger="change">
|
||||
<option value="" disabled selected>Choose a product</option>
|
||||
<option value="<product:Basic>">Basic</option>
|
||||
<option value="<product:Forum>">Forum</option>
|
||||
<option value="<product:Forum2>">Forum2</option>
|
||||
<option value="<product:Large>">Large</option>
|
||||
<option value="<product:Lite>">Lite</option>
|
||||
<option value="<product:Lite2>">Lite2</option>
|
||||
<option value="<product:Mid>">Mid</option>
|
||||
<option value="<product:Plus>">Plus</option>
|
||||
<option value="<product:Pro>">Pro</option>
|
||||
<option value="<product:Small>">Small</option>
|
||||
<option value="<product:Small2>">Small2</option>
|
||||
<option value="<product:Starter>">Starter</option>
|
||||
<option value="<product:Starter2>">Starter2</option>
|
||||
<option value="<product:Top>">Top</option>
|
||||
|
||||
</select>
|
||||
|
||||
<div id="form-operator.enrollment.grant.issue-product_id-warning"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div id="form-operator.enrollment.grant.issue-quantity" class="mb-3 app-form-field">
|
||||
|
||||
|
||||
<label class="form-label" for="form-operator.enrollment.grant.issue-quantity-control">Quantity <span class="text-muted">(optional)</span></label> <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Quantity" data-bs-content="Seats, for per-seat products." aria-label="Help: Quantity"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button>
|
||||
|
||||
<input type="number" class="form-control" id="form-operator.enrollment.grant.issue-quantity-control" name="quantity" value="" placeholder="1" min="1" max="1000000">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div id="form-operator.enrollment.grant.issue-valid_until" class="mb-3 app-form-field">
|
||||
|
||||
|
||||
<label class="form-label" for="form-operator.enrollment.grant.issue-valid_until-control">Valid until <span class="text-muted">(optional)</span></label> <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Valid until" data-bs-content="Leave blank for a grant with no end date." aria-label="Help: Valid until"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button>
|
||||
|
||||
<input type="datetime-local" class="form-control" id="form-operator.enrollment.grant.issue-valid_until-control" name="valid_until" value="" >
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div id="form-operator.enrollment.grant.issue-reason" class="mb-3 app-form-field">
|
||||
|
||||
|
||||
<label class="form-label" for="form-operator.enrollment.grant.issue-reason-control">Reason</label>
|
||||
|
||||
<select class="form-select" id="form-operator.enrollment.grant.issue-reason-control" name="reason" required>
|
||||
<option value="" disabled selected>Choose a reason</option>
|
||||
<option value="manual">manual</option>
|
||||
<option value="evaluation">evaluation</option>
|
||||
<option value="promotional">promotional</option>
|
||||
<option value="complimentary">complimentary</option>
|
||||
<option value="sponsored">sponsored</option>
|
||||
<option value="board_decision">board_decision</option>
|
||||
<option value="legacy">legacy</option>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div id="form-operator.enrollment.grant.issue-description" class="mb-3 app-form-field">
|
||||
|
||||
|
||||
<label class="form-label" for="form-operator.enrollment.grant.issue-description-control">Note <span class="text-muted">(optional)</span></label> <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Note" data-bs-content="Why this grant is issued. Shown with the grant in its history." aria-label="Help: Note"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button>
|
||||
|
||||
<input type="text" class="form-control" id="form-operator.enrollment.grant.issue-description-control" name="description" value="" maxlength="500" autocomplete="off">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div id="form-operator.enrollment.grant.issue-resumes_after_supersession" class="mb-3 app-form-field">
|
||||
|
||||
|
||||
|
||||
<label class="form-label" for="form-operator.enrollment.grant.issue-resumes_after_supersession-control">Resumes</label> <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Resumes" data-bs-content="If a plan replaces this grant, the grant delivers again when that plan ends." aria-label="Help: Resumes"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button>
|
||||
|
||||
<div class="app-form-check-control"><input class="form-check-input" type="checkbox" id="form-operator.enrollment.grant.issue-resumes_after_supersession-control" name="resumes_after_supersession" value="true" ></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-wrap gap-2 app-form-commit">
|
||||
|
||||
<button type="submit" class="btn btn-primary"><span class="spinner-border spinner-border-sm htmx-indicator me-1" aria-hidden="true"></span>Issue grant</button>
|
||||
|
||||
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-toggle="collapse" data-bs-target="#issueGrantPanel">Cancel</button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 mb-2">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<form id="form-operator.list.controls" data-form="operator.list.controls" data-form-kind="search" class="app-form app-form-bar" method="GET" action="/operator/organizations/<org:grant-over-subscription-paused>" role="search" hx-get="/operator/organizations/<org:grant-over-subscription-paused>" hx-target="#plan-grants-panel" hx-swap="outerHTML" hx-push-url="true" hx-select="#plan-grants-panel" hx-select-oob="#tier-changes-panel,#entitlement-changes-panel">
|
||||
<div id="form-operator.list.controls-error" class="app-form-error" role="alert"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="form-label visually-hidden" for="form-operator.list.controls-q-control">Search this list</label>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" aria-hidden="true"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.44.44.98.98l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.98-.98zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/></svg></span>
|
||||
<input type="text" class="form-control" id="form-operator.list.controls-q-control" name="q" value="" placeholder="Product or reason" autocomplete="off">
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-outline-secondary"><span class="spinner-border spinner-border-sm htmx-indicator me-1" aria-hidden="true"></span>Search</button>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="grants-ledger">
|
||||
|
||||
|
||||
<form id="form-operator.enrollment.grant.manage" data-form="operator.enrollment.grant.manage" data-form-kind="batch" class="app-form" novalidate hx-post="/partials/operator/organizations/<org:grant-over-subscription-paused>/grants/ledger" hx-target="#grants-ledger" hx-swap="outerHTML" hx-disable="find button[type=submit]" hx-indicator="find .htmx-indicator">
|
||||
<div id="form-operator.enrollment.grant.manage-error" class="app-form-error" role="alert"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="table-responsive app-scrollbox">
|
||||
<table class="table table-hover table-sm table-record align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Product</th>
|
||||
<th>Reason</th>
|
||||
<th>Issuance <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Issuance" data-bs-content="What the record says happened to the grant: active, revoked, or expired." aria-label="Help: Issuance"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button></th>
|
||||
<th>Delivery <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Delivery" data-bs-content="Whether the grant is delivering into the pool now." aria-label="Help: Delivery"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button></th>
|
||||
<th>Resumes <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Resumes" data-bs-content="If a plan replaces this grant, the grant delivers again when that plan ends." aria-label="Help: Resumes"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button></th>
|
||||
<th>Granted by</th>
|
||||
<th>Qty</th>
|
||||
<th>Activated</th>
|
||||
|
||||
<th>Valid until</th>
|
||||
<th class="text-end"><span class="visually-hidden">Actions</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<th scope="row">Small2</th>
|
||||
<td class="text-break"><small class="text-muted">complimentary</small></td>
|
||||
<td><small>Active</small></td>
|
||||
<td><span class="badge text-bg-success">Live</span></td>
|
||||
<td>No</td>
|
||||
<td><a href="/operator/persons/<person:Ann>">Ann</a></td>
|
||||
<td>1</td>
|
||||
<td class="text-nowrap"><small><span class="d-block"><today></span><span class="d-block text-muted"><hh:mm></span></small></td>
|
||||
|
||||
<td class="text-nowrap"><small>—</small></td>
|
||||
|
||||
<td class="text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ms-1" hx-post="/partials/operator/organizations/<org:grant-over-subscription-paused>/grants/ledger" hx-vals='{"act":"manage","key":"<grant:Small2>"}' hx-include="closest form" hx-target="#grants-ledger" hx-swap="outerHTML" aria-expanded="false"><svg class="app-opener-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true" focusable="false"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>Manage</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mt-2">
|
||||
<p class="small text-body-secondary mb-0">Showing 1–1 of 1</p>
|
||||
|
||||
<p class="small text-body-secondary mb-0">Per page:
|
||||
|
||||
<strong>10</strong>
|
||||
|
||||
<a href="/operator/organizations/<org:grant-over-subscription-paused>?per=25" hx-get="/operator/organizations/<org:grant-over-subscription-paused>?per=25" hx-target="#plan-grants-panel" hx-select="#plan-grants-panel" hx-select-oob="#tier-changes-panel,#entitlement-changes-panel" hx-swap="outerHTML" hx-push-url="true">25</a>
|
||||
|
||||
<a href="/operator/organizations/<org:grant-over-subscription-paused>?per=50" hx-get="/operator/organizations/<org:grant-over-subscription-paused>?per=50" hx-target="#plan-grants-panel" hx-select="#plan-grants-panel" hx-select-oob="#tier-changes-panel,#entitlement-changes-panel" hx-swap="outerHTML" hx-push-url="true">50</a>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between gap-3 mt-4 mb-2 app-section-header">
|
||||
<h2 class="h5 mb-0">Members</h2>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="text-center py-4">
|
||||
<p class="text-muted mb-2">No members.</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between gap-3 mt-4 mb-2 app-section-header">
|
||||
<h2 class="h5 mb-0">Entitlement changes</h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="entitlement-changes-panel">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="text-center py-4">
|
||||
<p class="text-muted mb-2">No entitlement changes recorded yet.</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between gap-3 mt-4 mb-2 app-section-header">
|
||||
<h2 class="h5 mb-0">Tier changes <button type="button" class="btn btn-link p-0 border-0 align-baseline app-help-icon" data-bs-toggle="popover" data-bs-trigger="click" data-bs-title="Tier changes" data-bs-content="Every tier change on this organization's plan ladders, newest first. Tier names reflect the ladder's current shape." aria-label="Help: Tier changes"><svg class="form-help-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></button></h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tier-changes-panel">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm table-record">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ladder</th>
|
||||
<th>Change</th>
|
||||
<th>From</th>
|
||||
<th>To</th>
|
||||
<th>By</th>
|
||||
<th>Reason</th>
|
||||
<th>When</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Box</th>
|
||||
<td><span class="badge text-bg-light border" title="Same tier, different funding source: another grant or subscription took over this placement.">Transferred<span class="visually-hidden">, Same tier, different funding source: another grant or subscription took over this placement.</span></span></td>
|
||||
<td>Small2</td>
|
||||
<td>Small2</td>
|
||||
<td>
|
||||
Ann
|
||||
</td>
|
||||
<td class="text-break" title="test fixture">Complimentary</td>
|
||||
<td class="text-nowrap"><small><span class="d-block"><today></span><span class="d-block text-muted"><hh:mm></span></small></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Box</th>
|
||||
<td><span class="badge text-bg-light border">Started</span></td>
|
||||
<td>—</td>
|
||||
<td>Small2</td>
|
||||
<td>
|
||||
<em class="text-muted">webhook</em>
|
||||
</td>
|
||||
<td class="text-break" title="test fixture">test fixture</td>
|
||||
<td class="text-nowrap"><small><span class="d-block"><today></span><span class="d-block text-muted"><hh:mm></span></small></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mt-2">
|
||||
<p class="small text-body-secondary mb-0">Showing 1–2 of 2</p>
|
||||
|
||||
<p class="small text-body-secondary mb-0">Per page:
|
||||
|
||||
<strong>10</strong>
|
||||
|
||||
<a href="/operator/organizations/<org:grant-over-subscription-paused>?tc_per=25" hx-get="/operator/organizations/<org:grant-over-subscription-paused>?tc_per=25" hx-target="#tier-changes-panel" hx-select="#tier-changes-panel" hx-select-oob="#plan-grants-panel,#entitlement-changes-panel" hx-swap="outerHTML" hx-push-url="true">25</a>
|
||||
|
||||
<a href="/operator/organizations/<org:grant-over-subscription-paused>?tc_per=50" hx-get="/operator/organizations/<org:grant-over-subscription-paused>?tc_per=50" hx-target="#tier-changes-panel" hx-select="#tier-changes-panel" hx-select-oob="#plan-grants-panel,#entitlement-changes-panel" hx-swap="outerHTML" hx-push-url="true">50</a>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
{
|
||||
"ActionError": "",
|
||||
"BillingSummary": {
|
||||
"HasAccount": true,
|
||||
"BillingAccountID": "<uuid>",
|
||||
"AccountStatus": "active",
|
||||
"SubscriptionCount": 1,
|
||||
"SubscriptionState": "active",
|
||||
"SubscriptionNote": "renews Jan 15, 2099",
|
||||
"DisplacementTitle": "Billing paused while a grant holds Box.",
|
||||
"DisplacementError": "",
|
||||
"HasInvoice": false,
|
||||
"LatestInvoiceID": "",
|
||||
"LatestInvoiceNumber": "",
|
||||
"LatestInvoiceDate": "",
|
||||
"InvoiceState": "",
|
||||
"OutstandingBalance": 0,
|
||||
"OutstandingBalanceFormatted": "0.00",
|
||||
"Currency": ""
|
||||
},
|
||||
"EntitlementChanges": [],
|
||||
"EntitlementChangesError": "",
|
||||
"EntitlementChangesNav": {
|
||||
"BasePath": "/operator/organizations/<org:grant-over-subscription-paused>",
|
||||
"SearchPlaceholder": "",
|
||||
"FacetParam": "",
|
||||
"FacetOptions": null,
|
||||
"Q": "",
|
||||
"Facet": "",
|
||||
"Page": 1,
|
||||
"Total": 0,
|
||||
"ParamPrefix": "ec_",
|
||||
"Extra": {},
|
||||
"PerPage": 10,
|
||||
"DefaultPerPage": 10,
|
||||
"PerPageOptions": [
|
||||
10,
|
||||
25,
|
||||
50
|
||||
],
|
||||
"Target": "#entitlement-changes-panel",
|
||||
"SyncSelect": "#plan-grants-panel,#tier-changes-panel"
|
||||
},
|
||||
"EntitlementChangesTotal": 0,
|
||||
"Error": "",
|
||||
"GrantsError": "",
|
||||
"GrantsListQuery": "",
|
||||
"GrantsNav": {
|
||||
"BasePath": "/operator/organizations/<org:grant-over-subscription-paused>",
|
||||
"SearchPlaceholder": "Product or reason",
|
||||
"FacetParam": "tab",
|
||||
"FacetOptions": [
|
||||
{
|
||||
"Value": "",
|
||||
"Label": "Active"
|
||||
},
|
||||
{
|
||||
"Value": "history",
|
||||
"Label": "History"
|
||||
}
|
||||
],
|
||||
"Q": "",
|
||||
"Facet": "",
|
||||
"Page": 1,
|
||||
"Total": 1,
|
||||
"ParamPrefix": "",
|
||||
"Extra": {},
|
||||
"PerPage": 10,
|
||||
"DefaultPerPage": 10,
|
||||
"PerPageOptions": [
|
||||
10,
|
||||
25,
|
||||
50
|
||||
],
|
||||
"Target": "#plan-grants-panel",
|
||||
"SyncSelect": "#tier-changes-panel,#entitlement-changes-panel"
|
||||
},
|
||||
"GrantsTotal": 1,
|
||||
"IssuanceProducts": [
|
||||
{
|
||||
"ProductID": "<product:Basic>",
|
||||
"Name": "Basic",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Forum>",
|
||||
"Name": "Forum",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Forum2>",
|
||||
"Name": "Forum2",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Large>",
|
||||
"Name": "Large",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Lite>",
|
||||
"Name": "Lite",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Lite2>",
|
||||
"Name": "Lite2",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Mid>",
|
||||
"Name": "Mid",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Plus>",
|
||||
"Name": "Plus",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Pro>",
|
||||
"Name": "Pro",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Small>",
|
||||
"Name": "Small",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Small2>",
|
||||
"Name": "Small2",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Starter>",
|
||||
"Name": "Starter",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Starter2>",
|
||||
"Name": "Starter2",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
},
|
||||
{
|
||||
"ProductID": "<product:Top>",
|
||||
"Name": "Top",
|
||||
"IsInternal": false,
|
||||
"DisplayCategory": "",
|
||||
"SupersedesSubscription": false
|
||||
}
|
||||
],
|
||||
"Members": [],
|
||||
"MembersCapped": false,
|
||||
"MembersError": "",
|
||||
"MembersTotal": 0,
|
||||
"OrgID": "<org:grant-over-subscription-paused>",
|
||||
"OrgKey": "",
|
||||
"OrgName": "grant-over-subscription-paused",
|
||||
"OrgOwnerName": "Ann",
|
||||
"OrgOwnerPersonID": "<person:Ann>",
|
||||
"PoolMissing": false,
|
||||
"Pools": [
|
||||
{
|
||||
"PoolID": "<pool:grant-over-subscription-paused>",
|
||||
"PoolName": "Default",
|
||||
"PoolType": "default",
|
||||
"Status": "active",
|
||||
"Deliveries": [
|
||||
{
|
||||
"ProvisionID": "<provision:Small2>",
|
||||
"ProductName": "Small2",
|
||||
"ProductID": "<product:Small2>",
|
||||
"Rungs": [
|
||||
{
|
||||
"LadderName": "Box",
|
||||
"Rank": 0,
|
||||
"ActivatedAt": "<today> <hh:mm>"
|
||||
}
|
||||
],
|
||||
"Suspended": false
|
||||
}
|
||||
],
|
||||
"Usage": null,
|
||||
"HasAttachment": true
|
||||
}
|
||||
],
|
||||
"ProductsError": "",
|
||||
"TierChangesNav": {
|
||||
"BasePath": "/operator/organizations/<org:grant-over-subscription-paused>",
|
||||
"SearchPlaceholder": "",
|
||||
"FacetParam": "",
|
||||
"FacetOptions": null,
|
||||
"Q": "",
|
||||
"Facet": "",
|
||||
"Page": 1,
|
||||
"Total": 2,
|
||||
"ParamPrefix": "tc_",
|
||||
"Extra": {},
|
||||
"PerPage": 10,
|
||||
"DefaultPerPage": 10,
|
||||
"PerPageOptions": [
|
||||
10,
|
||||
25,
|
||||
50
|
||||
],
|
||||
"Target": "#tier-changes-panel",
|
||||
"SyncSelect": "#plan-grants-panel,#entitlement-changes-panel"
|
||||
},
|
||||
"Transitions": [
|
||||
{
|
||||
"TransitionID": "<uuid>",
|
||||
"TransitionType": "transfer",
|
||||
"LadderName": "Box",
|
||||
"ChangeLabel": "Transferred",
|
||||
"ChangeTooltip": "Same tier, different funding source: another grant or subscription took over this placement.",
|
||||
"ChangeKind": "",
|
||||
"FromLabel": "Small2",
|
||||
"ToLabel": "Small2",
|
||||
"ActorType": "operator",
|
||||
"ActorName": "Ann",
|
||||
"ReasonLabel": "Complimentary",
|
||||
"ReasonNote": "",
|
||||
"ReasonRaw": "test fixture",
|
||||
"EffectiveAt": {
|
||||
"Date": "<today>",
|
||||
"Time": "<hh:mm>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"TransitionID": "<uuid>",
|
||||
"TransitionType": "initiate",
|
||||
"LadderName": "Box",
|
||||
"ChangeLabel": "Started",
|
||||
"ChangeTooltip": "",
|
||||
"ChangeKind": "",
|
||||
"FromLabel": "—",
|
||||
"ToLabel": "Small2",
|
||||
"ActorType": "webhook",
|
||||
"ActorName": "",
|
||||
"ReasonLabel": "test fixture",
|
||||
"ReasonNote": "",
|
||||
"ReasonRaw": "test fixture",
|
||||
"EffectiveAt": {
|
||||
"Date": "<today>",
|
||||
"Time": "<hh:mm>"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransitionsError": "",
|
||||
"TransitionsTotal": 2
|
||||
}
|
||||
@@ -185,7 +185,7 @@
|
||||
<form id="form-operator.enrollment.grant.issue" data-form="operator.enrollment.grant.issue" data-form-kind="create" class="app-form" novalidate hx-post="/partials/operator/organizations/<org:rich>/grant/create" hx-target="#operator-body" hx-swap="innerHTML" hx-disable="find button[type=submit]" hx-indicator="find .htmx-indicator">
|
||||
<div id="form-operator.enrollment.grant.issue-error" class="app-form-error" role="alert"></div>
|
||||
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; the subscription keeps billing and delivers nothing on that ladder until the grant ends.</div></div>
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; its billing pauses until the grant ends.</div></div>
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@
|
||||
<form id="form-operator.enrollment.grant.issue" data-form="operator.enrollment.grant.issue" data-form-kind="create" class="app-form" novalidate hx-post="/partials/operator/organizations/<org:rich>/grant/create" hx-target="#operator-body" hx-swap="innerHTML" hx-disable="find button[type=submit]" hx-indicator="find .htmx-indicator">
|
||||
<div id="form-operator.enrollment.grant.issue-error" class="app-form-error" role="alert"></div>
|
||||
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; the subscription keeps billing and delivers nothing on that ladder until the grant ends.</div></div>
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; its billing pauses until the grant ends.</div></div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<form id="form-operator.enrollment.grant.issue" data-form="operator.enrollment.grant.issue" data-form-kind="create" class="app-form" novalidate hx-post="/partials/operator/organizations/<org:suspended-subscription>/grant/create" hx-target="#operator-body" hx-swap="innerHTML" hx-disable="find button[type=submit]" hx-indicator="find .htmx-indicator">
|
||||
<div id="form-operator.enrollment.grant.issue-error" class="app-form-error" role="alert"></div>
|
||||
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; the subscription keeps billing and delivers nothing on that ladder until the grant ends.</div></div>
|
||||
<div class="app-form-message mb-2">A tier product moves the pool to that tier, up or down.<div class="alert alert-warning py-1 px-2 small mt-2 mb-0" role="alert">Products marked ⚠ would supersede a tier a subscription pays for; its billing pauses until the grant ends.</div></div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -102,11 +102,11 @@ Sections 1 to 12 are one commit each, and their items are that commit's parts; s
|
||||
|
||||
## 5. The operator reads the confirmed pause
|
||||
|
||||
- [ ] 5.1 `internal/server/operator_enrollment.go` (design D16): `subscriptionRef` gains `PauseBehavior string` from the row; `displacedSubscription` gains `Paused bool`; `displacedOnPage` (`operator_enrollment.go:495`, whose signature gains the behavior) sets it when the ref's behavior is set and every displacement it picked has `HolderSource == "grant"`. The organization page's subscription read and `ListSubscriptionsPage` carry the behavior (section 2's column).
|
||||
- [ ] 5.2 `displacementTitle(subscriptions int, displaced []displacedSubscription) string` builds the titles of Copy O0, O1, O2 and the existing forms: it splits the displaced subscriptions into paused and not, builds each part's ladders and holder as today, and joins the paused sentence and the continuing sentence with one space; one subscription on the account gives the one-subscription forms. The paused sentence's holder is "a grant holds" when one grant provision holds every ladder it names and "grants hold" when several do, counted by provision as `displacementHolder` counts (design D16). Its doc comment states the three forms, the two holder forms, and that the record, never the rule, decides "paused".
|
||||
- [ ] 5.3 `subscriptionTitlesFor` (`internal/server/operator_billing.go:643`) passes the row's behavior, so a row reads O0 or the existing one-subscription form.
|
||||
- [ ] 5.4 `internal/server/operator_enrollment_forms.go:130-134`: `issueGrantSupersedeWarning` reads Copy W, and its comment says why the grant pauses the subscription's billing.
|
||||
- [ ] 5.5 Tests:
|
||||
- [x] 5.1 `internal/server/operator_enrollment.go` (design D16): `subscriptionRef` gains `PauseBehavior string` from the row; `displacedSubscription` gains `Paused bool`; `displacedOnPage` (`operator_enrollment.go:495`, whose signature gains the behavior) sets it when the ref's behavior is set and every displacement it picked has `HolderSource == "grant"`. The organization page's subscription read and `ListSubscriptionsPage` carry the behavior (section 2's column).
|
||||
- [x] 5.2 `displacementTitle(subscriptions int, displaced []displacedSubscription) string` builds the titles of Copy O0, O1, O2 and the existing forms: it splits the displaced subscriptions into paused and not, builds each part's ladders and holder as today, and joins the paused sentence and the continuing sentence with one space; one subscription on the account gives the one-subscription forms. The paused sentence's holder is "a grant holds" when one grant provision holds every ladder it names and "grants hold" when several do, counted by provision as `displacementHolder` counts (design D16). Its doc comment states the three forms, the two holder forms, and that the record, never the rule, decides "paused".
|
||||
- [x] 5.3 `subscriptionTitlesFor` (`internal/server/operator_billing.go:643`) passes the row's behavior, so a row reads O0 or the existing one-subscription form.
|
||||
- [x] 5.4 `internal/server/operator_enrollment_forms.go:130-134`: `issueGrantSupersedeWarning` reads Copy W, and its comment says why the grant pauses the subscription's billing.
|
||||
- [x] 5.5 Tests:
|
||||
- `TestDisplacementTitle` (`internal/server/operator_enrollment_render_test.go:1335`), rows added to `displacementTitleRows`: `one subscription, paused` (O0, "Billing paused while a grant holds Demo Ladder."); `one subscription, pause not confirmed` (the existing form); `three subscriptions, two paused` (O1); `three subscriptions, one paused, one continuing under another subscription` (O2, "Billing paused on 1 of 3 subscriptions while a grant holds Hosting. Billing continues on 1 while another subscription holds Wiki."); `one subscription, paused under two grants` (O0, "Billing paused while grants hold Hosting and Wiki."); `one subscription, paused under one bundle grant on two ladders` (O0, "Billing paused while a grant holds Hosting and Wiki."); `three subscriptions, two paused under two grants` (O1, "Billing paused on 2 of 3 subscriptions while grants hold Hosting and Wiki."); `paused but held by a purchase` (the existing form). Failure text unchanged: `displacementTitle(%s) = %q, want %q`.
|
||||
- `TestDisplacedOnPage` rows: `a recorded pause under grants` (Paused true), `a recorded foreign pause under grants` (the behavior set by `ForeignPause`, Paused true), `a recorded pause under a subscription` (Paused false). Failure text unchanged.
|
||||
- `TestSubscriptionTitlesFor` rows: `a paused row` reads O0. Failure text unchanged.
|
||||
@@ -115,9 +115,9 @@ Sections 1 to 12 are one commit each, and their items are that commit's parts; s
|
||||
- `TestOrgEnrollmentGolden`: the three states whose Issue grant panel shows the warning, `internal/server/testdata/org_enrollment/rich.html`, `rich-history-search.html` and `suspended-subscription.html`, rewritten with `-update` and read: each changes only in the warning's sentence, which reads Copy W. Their `.json` files do not change, because the view model does not carry the warning's text.
|
||||
- `TestSubscriptionsListMarksAPausedSubscription` (`internal/server/operator_subscriptions_displacement_db_test.go`): a displaced subscription from the kit with `PauseCollection` titles O0, and one without it the existing title. Failure text: `subscriptions list title = %q, want %q`.
|
||||
- `TestOperatorPagesReadAFixedNumberOfTimes` passes unedited.
|
||||
- [ ] 5.6 No other golden changes: the subscriptions page's goldens (`internal/server/testdata/operator_billing/subscriptions-all.json` and `subscriptions-default.json`) serialize `SubscriptionViewModel` (`internal/server/operator_billing.go:431`), which gains no field, and their fixture holds no paused subscription; no other organization page state records a pause. Any other change is a stop.
|
||||
- [ ] 5.7 Docs: `docs/stripe.md`'s grant bullet names the badge's paused title, "Billing paused while a grant holds {ladder}." ("grants hold" when several grants hold the ladders), once Stripe confirms the pause, and the existing title while it does not; `docs/plan-management.md:157` and `:164` (the grant over a paid plan and the badge) read the same.
|
||||
- [ ] 5.8 Breaks:
|
||||
- [x] 5.6 No other golden changes: the subscriptions page's goldens (`internal/server/testdata/operator_billing/subscriptions-all.json` and `subscriptions-default.json`) serialize `SubscriptionViewModel` (`internal/server/operator_billing.go:431`), which gains no field, and their fixture holds no paused subscription; no other organization page state records a pause. Any other change is a stop.
|
||||
- [x] 5.7 Docs: `docs/stripe.md`'s grant bullet names the badge's paused title, "Billing paused while a grant holds {ladder}." ("grants hold" when several grants hold the ladders), once Stripe confirms the pause, and the existing title while it does not; `docs/plan-management.md:157` and `:164` (the grant over a paid plan and the badge) read the same.
|
||||
- [x] 5.8 Breaks:
|
||||
- the record ignored (`Paused` forced false in `displacedOnPage`): caught by `TestDisplacedOnPage`, `want_new` `displacedOnPage(a recorded pause under grants) =`, and by `TestOrgEnrollmentGolden/grant-over-subscription-paused`, `want_new` `testdata/org_enrollment/grant-over-subscription-paused.html differs from what the code produced`;
|
||||
- the holder test dropped (a pause under a subscription reads paused): caught by `TestDisplacedOnPage`, `want_new` `displacedOnPage(a recorded pause under a subscription) =`;
|
||||
- the mixed form's second sentence dropped: caught by `TestDisplacementTitle`, `want_new` `displacementTitle(three subscriptions, one paused, one continuing under another subscription) =`;
|
||||
@@ -126,7 +126,7 @@ Sections 1 to 12 are one commit each, and their items are that commit's parts; s
|
||||
- the list row ignoring the behavior: caught by `TestSubscriptionTitlesFor`, `want_new` `subscriptionTitlesFor(a paused row) =`;
|
||||
- the warning's old text restored: caught by `TestOrgEnrollmentIssueGrantPanel_Stacked`, `want_new` `the stacked Issue grant panel lacks`;
|
||||
- the list's paused title not rendered: caught by `TestSubscriptionsListMarksAPausedSubscription`, `want_new` `subscriptions list title =`.
|
||||
- [ ] 5.9 `make screens`: the Issue grant captures that show the warning change, at both widths. The paused title is an attribute no capture shows; the golden pins it.
|
||||
- [x] 5.9 `make screens`: no change. No capture shows the warning: the captured organization's one subscription, Carlos's, holds no tier, so no product the Issue grant select offers carries the marker; the goldens of 5.5 pin the warning's text. The paused title is an attribute no capture shows; the golden pins it.
|
||||
|
||||
## 6. An hourly sweep asks again for a subscription whose pause disagrees with the rule
|
||||
|
||||
|
||||
Reference in New Issue
Block a user