mirror of https://github.com/zulip/zulip.git
support: Add option to upgrade an org to Plus plan on /activity/support.
This is so that we don't need ops to run the manage.py switch_realm_from_standard_to_plus_plan command on the server to handle these upgrades.
This commit is contained in:
parent
1a15449e16
commit
24d9d3d90c
|
@ -667,6 +667,17 @@ class TestSupportEndpoint(ZulipTestCase):
|
|||
["zulip downgraded and voided 1 open invoices"], result
|
||||
)
|
||||
|
||||
with mock.patch("analytics.views.support.switch_realm_from_standard_to_plus_plan") as m:
|
||||
result = self.client_post(
|
||||
"/activity/support",
|
||||
{
|
||||
"realm_id": f"{iago.realm_id}",
|
||||
"modify_plan": "upgrade_to_plus",
|
||||
},
|
||||
)
|
||||
m.assert_called_once_with(get_realm("zulip"))
|
||||
self.assert_in_success_response(["zulip upgraded to Plus"], result)
|
||||
|
||||
def test_scrub_realm(self) -> None:
|
||||
cordelia = self.example_user("cordelia")
|
||||
lear_realm = get_realm("lear")
|
||||
|
|
|
@ -54,6 +54,7 @@ if settings.BILLING_ENABLED:
|
|||
get_discount_for_realm,
|
||||
get_latest_seat_count,
|
||||
make_end_of_cycle_updates_if_needed,
|
||||
switch_realm_from_standard_to_plus_plan,
|
||||
update_billing_method_of_current_plan,
|
||||
update_sponsorship_status,
|
||||
void_all_open_invoices,
|
||||
|
@ -125,6 +126,7 @@ VALID_MODIFY_PLAN_METHODS = [
|
|||
"downgrade_at_billing_cycle_end",
|
||||
"downgrade_now_without_additional_licenses",
|
||||
"downgrade_now_void_open_invoices",
|
||||
"upgrade_to_plus",
|
||||
]
|
||||
|
||||
VALID_STATUS_VALUES = [
|
||||
|
@ -268,6 +270,9 @@ def support(
|
|||
context[
|
||||
"success_message"
|
||||
] = f"{realm.string_id} downgraded and voided {voided_invoices_count} open invoices"
|
||||
elif modify_plan == "upgrade_to_plus":
|
||||
switch_realm_from_standard_to_plus_plan(realm)
|
||||
context["success_message"] = f"{realm.string_id} upgraded to Plus"
|
||||
elif scrub_realm:
|
||||
do_scrub_realm(realm, acting_user=acting_user)
|
||||
context["success_message"] = f"{realm.string_id} scrubbed."
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
<option value="downgrade_at_billing_cycle_end">Downgrade at the end of current billing cycle</option>
|
||||
<option value="downgrade_now_without_additional_licenses">Downgrade now without creating additional invoices</option>
|
||||
<option value="downgrade_now_void_open_invoices">Downgrade now and void open invoices</option>
|
||||
<option value="upgrade_to_plus">Upgrade to the Plus plan</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-default support-submit-button">Modify</button>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue