mirror of https://github.com/zulip/zulip.git
stripe: End legacy plan before approving full sponsorship.
This commit is contained in:
parent
612f2c73d6
commit
a5311c8032
|
@ -3204,6 +3204,15 @@ class RemoteRealmBillingSession(BillingSession):
|
||||||
if error_message != "":
|
if error_message != "":
|
||||||
return error_message
|
return error_message
|
||||||
|
|
||||||
|
if self.remote_realm.plan_type == RemoteRealm.PLAN_TYPE_SELF_MANAGED_LEGACY:
|
||||||
|
plan = get_current_plan_by_customer(customer)
|
||||||
|
# Ideally we should have always have a plan here but since this is support page, we can be lenient about it.
|
||||||
|
if plan is not None:
|
||||||
|
assert self.get_next_plan(plan) is None
|
||||||
|
assert plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
|
||||||
|
plan.status = CustomerPlan.ENDED
|
||||||
|
plan.save(update_fields=["status"])
|
||||||
|
|
||||||
self.do_change_plan_type(tier=None, is_sponsored=True)
|
self.do_change_plan_type(tier=None, is_sponsored=True)
|
||||||
if customer is not None and customer.sponsorship_pending:
|
if customer is not None and customer.sponsorship_pending:
|
||||||
customer.sponsorship_pending = False
|
customer.sponsorship_pending = False
|
||||||
|
@ -3596,6 +3605,15 @@ class RemoteServerBillingSession(BillingSession):
|
||||||
if error_message != "":
|
if error_message != "":
|
||||||
return error_message
|
return error_message
|
||||||
|
|
||||||
|
if self.remote_server.plan_type == RemoteZulipServer.PLAN_TYPE_SELF_MANAGED_LEGACY:
|
||||||
|
plan = get_current_plan_by_customer(customer)
|
||||||
|
# Ideally we should have always have a plan here but since this is support page, we can be lenient about it.
|
||||||
|
if plan is not None:
|
||||||
|
assert self.get_next_plan(plan) is None
|
||||||
|
assert plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
|
||||||
|
plan.status = CustomerPlan.ENDED
|
||||||
|
plan.save(update_fields=["status"])
|
||||||
|
|
||||||
self.do_change_plan_type(tier=None, is_sponsored=True)
|
self.do_change_plan_type(tier=None, is_sponsored=True)
|
||||||
if customer is not None and customer.sponsorship_pending:
|
if customer is not None and customer.sponsorship_pending:
|
||||||
customer.sponsorship_pending = False
|
customer.sponsorship_pending = False
|
||||||
|
|
Loading…
Reference in New Issue