Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stripe: Change realm.plan_type when upgrading a realm to Plus plan.
Mateusz Mandera89a72c92ea33
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 42214d8ed20..4311db0cbf6 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -1187,6 +1187,10 @@ def switch_realm_from_standard_to_plus_plan(realm: Realm) -> None:standard_plan.next_invoice_date = plan_switch_timestandard_plan.save(update_fields=["status", "next_invoice_date"])+ from zerver.actions.realm_settings import do_change_realm_plan_type++ do_change_realm_plan_type(realm, Realm.PLAN_TYPE_PLUS, acting_user=None)+standard_plan_next_renewal_date = start_of_next_billing_cycle(standard_plan, plan_switch_time)standard_plan_last_renewal_ledger = (diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 33289b1f79b..8ced58c60df 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -3804,6 +3804,9 @@ class StripeTest(StripeTestCase):self.assertEqual(plus_plan.tier, CustomerPlan.PLUS)self.assertEqual(LicenseLedger.objects.filter(plan=plus_plan).count(), 1)+ realm.refresh_from_db()+ self.assertEqual(realm.plan_type, Realm.PLAN_TYPE_PLUS)+# There are 9 licenses and the realm is on the Standard monthly plan.# Therefore, the customer has already paid 800 * 9 = 7200 = $72 for# the month. Once they upgrade to Plus, the new price for their 9