stripe: Disable free trial for self hosted customers.

This commit is contained in:
Aman Agrawal 2023-12-11 17:17:41 +00:00 committed by Tim Abbott
parent 23d712391e
commit eb92b31e1d
2 changed files with 10 additions and 0 deletions

View File

@ -1143,6 +1143,10 @@ class BillingSession(ABC):
assert customer.stripe_customer_id is not None # for mypy assert customer.stripe_customer_id is not None # for mypy
self.ensure_current_plan_is_upgradable(customer, plan_tier) self.ensure_current_plan_is_upgradable(customer, plan_tier)
billing_cycle_anchor = None billing_cycle_anchor = None
if remote_server_legacy_plan is not None: # nocoverage
# Legacy servers don't get an additional free trial.
free_trial = False
if should_schedule_upgrade_for_legacy_remote_server: # nocoverage if should_schedule_upgrade_for_legacy_remote_server: # nocoverage
assert remote_server_legacy_plan is not None assert remote_server_legacy_plan is not None
billing_cycle_anchor = remote_server_legacy_plan.end_date billing_cycle_anchor = remote_server_legacy_plan.end_date

View File

@ -149,6 +149,9 @@ def remote_realm_plans_page(
if context.customer_plan is None: if context.customer_plan is None:
context.on_free_tier = not context.is_sponsored context.on_free_tier = not context.is_sponsored
else: else:
if context.customer_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY:
# Free trial is disabled for legacy customers.
context.free_trial_days = None
context.on_free_tier = context.customer_plan.tier in ( context.on_free_tier = context.customer_plan.tier in (
CustomerPlan.TIER_SELF_HOSTED_LEGACY, CustomerPlan.TIER_SELF_HOSTED_LEGACY,
CustomerPlan.TIER_SELF_HOSTED_BASE, CustomerPlan.TIER_SELF_HOSTED_BASE,
@ -198,6 +201,9 @@ def remote_server_plans_page(
if context.customer_plan is None: if context.customer_plan is None:
context.on_free_tier = not context.is_sponsored context.on_free_tier = not context.is_sponsored
else: else:
if context.customer_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY:
# Free trial is disabled for legacy customers.
context.free_trial_days = None
context.on_free_tier = context.customer_plan.tier in ( context.on_free_tier = context.customer_plan.tier in (
CustomerPlan.TIER_SELF_HOSTED_LEGACY, CustomerPlan.TIER_SELF_HOSTED_LEGACY,
CustomerPlan.TIER_SELF_HOSTED_BASE, CustomerPlan.TIER_SELF_HOSTED_BASE,