Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

corporate: Simplify initial plan tier switch check.

Lauryn Menard1f1f1b913b11
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index ccec4ce3d1a..88c92d1a37a 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -2502,12 +2502,8 @@ def switch_plan_tier(current_plan: CustomerPlan, new_plan_tier: int) -> None:
def switch_realm_from_standard_to_plus_plan(realm: Realm) -> None:
standard_plan = get_current_plan_by_realm(realm)
- if (
- not standard_plan
- or standard_plan.status != CustomerPlan.ACTIVE
- or standard_plan.tier != CustomerPlan.STANDARD
- ):
- raise BillingError("Organization does not have an active Standard plan")
+ if not standard_plan or standard_plan.status != CustomerPlan.ACTIVE:
+ raise BillingError("Organization does not have an active plan")
if not standard_plan.customer.stripe_customer_id:
raise BillingError("Organization missing Stripe customer.")
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index d96808c514e..54a1aaea810 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -3512,11 +3512,11 @@ class StripeTest(StripeTestCase):
iago = self.example_user("iago")
realm = iago.realm
- # Test upgrading to Plus when realm has no Standard subscription
+ # Test upgrading to Plus when realm has no active subscription
with self.assertRaises(BillingError) as billing_context:
switch_realm_from_standard_to_plus_plan(realm)
self.assertEqual(
- "Organization does not have an active Standard plan",
+ "Organization does not have an active plan",
billing_context.exception.error_description,
)