feat(billing): staff switch between managed and self-serve billing - #760
Merged
Conversation
Invariant: never orphan a live Mollie subscription. A live subscription
(payment_mode=="mollie" + subscription id) blocks tier and billing-mode changes
until the customer cancels. The customer billing page now reflects the real
subscription, not the `status` entitlement flag.
Backend
- billing_account.has_live_mollie_subscription() predicate.
- set_workspace_tier + set_managed: 409 before any write when it holds.
- set_saas(SetSaasBody): to_free -> tier=free; else keep tier + required
expires_at, which reverts to free via task_expire_workspace_tiers unless the
customer subscribes. status stays "active".
- get_billing_overview: +has_active_subscription, +has_payment_history.
- admin rollup: payment_mode on BillingRow.
Frontend
- Staff BillingModeControl (bidirectional, current tier, Free/keep-until-date
modal, disabled+reason on live sub) in the account + external-workspace modals;
ChangeTierControl disables Apply on live sub.
- Customer BillingManager: paid tier with no live sub shows "No subscription" /
"Ends <date>" + Subscribe, never a false "Active"; cancelled subs keep Resume.
Docs: docs/billing_modes.md. Tests: test_managed_billing.py (33 pass, 1 skip).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invariant: never orphan a live Mollie subscription. A live subscription
(payment_mode=="mollie" + subscription id) blocks tier and billing-mode changes
until the customer cancels. The customer billing page now reflects the real
subscription, not the
statusentitlement flag.Backend
Frontend
Docs: docs/billing_modes.md. Tests: test_managed_billing.py (33 pass, 1 skip).