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.

stripe: Don't change plan tier before the plan becomes live.

Aman Agrawal860e4f6060c6
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 7110246646c..3ba783cf441 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -1246,7 +1246,9 @@ class BillingSession(ABC):
)
stripe.Invoice.finalize_invoice(stripe_invoice)
- self.do_change_plan_type(tier=plan_tier)
+ if plan.status < CustomerPlan.LIVE_STATUS_THRESHOLD:
+ # Tier and usage limit change will happen when plan becomes live.
+ self.do_change_plan_type(tier=plan_tier)
def do_upgrade(self, upgrade_request: UpgradeRequest) -> Dict[str, Any]:
customer = self.get_customer()
@@ -1457,6 +1459,7 @@ class BillingSession(ABC):
)
new_plan.status = CustomerPlan.ACTIVE
new_plan.save(update_fields=["status"])
+ self.do_change_plan_type(tier=new_plan.tier)
return None, LicenseLedger.objects.create(
plan=new_plan,
is_renewal=True,