mirror of https://github.com/zulip/zulip.git
stripe: Don't allow free trial users to have paid plan states.
Free trial users can only switch to `ACTIVE` or `ENDED` as possible states. To switch to any other state, they need to be `ACTIVE` first.
This commit is contained in:
parent
d43a60eb9d
commit
22c333d135
|
@ -1385,6 +1385,7 @@ class BillingSession(ABC):
|
|||
assert plan.status < CustomerPlan.LIVE_STATUS_THRESHOLD
|
||||
do_change_plan_status(plan, status)
|
||||
elif status == CustomerPlan.DOWNGRADE_AT_END_OF_CYCLE:
|
||||
assert not plan.is_free_trial()
|
||||
assert plan.status < CustomerPlan.LIVE_STATUS_THRESHOLD
|
||||
self.downgrade_at_the_end_of_billing_cycle(plan=plan)
|
||||
elif status == CustomerPlan.SWITCH_TO_ANNUAL_AT_END_OF_CYCLE:
|
||||
|
@ -1392,6 +1393,8 @@ class BillingSession(ABC):
|
|||
assert plan.status < CustomerPlan.LIVE_STATUS_THRESHOLD
|
||||
# Customer needs to switch to an active plan first to avoid unexpected behavior.
|
||||
assert plan.status != CustomerPlan.DOWNGRADE_AT_END_OF_CYCLE
|
||||
# Switching billing frequency for free trial should happen instantly.
|
||||
assert not plan.is_free_trial()
|
||||
assert plan.fixed_price is None
|
||||
do_change_plan_status(plan, status)
|
||||
elif status == CustomerPlan.SWITCH_TO_MONTHLY_AT_END_OF_CYCLE:
|
||||
|
@ -1399,6 +1402,8 @@ class BillingSession(ABC):
|
|||
assert plan.status < CustomerPlan.LIVE_STATUS_THRESHOLD
|
||||
# Customer needs to switch to an active plan first to avoid unexpected behavior.
|
||||
assert plan.status != CustomerPlan.DOWNGRADE_AT_END_OF_CYCLE
|
||||
# Switching billing frequency for free trial should happen instantly.
|
||||
assert not plan.is_free_trial()
|
||||
assert plan.fixed_price is None
|
||||
do_change_plan_status(plan, status)
|
||||
elif status == CustomerPlan.ENDED:
|
||||
|
|
Loading…
Reference in New Issue