mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
billing: Create is_free_trial_offer_enabled function.
This commit is contained in:
@@ -501,6 +501,10 @@ def decimal_to_float(obj: object) -> object:
|
||||
raise TypeError # nocoverage
|
||||
|
||||
|
||||
def is_free_trial_offer_enabled() -> bool:
|
||||
return settings.FREE_TRIAL_DAYS not in (None, 0)
|
||||
|
||||
|
||||
# Only used for cloud signups
|
||||
@catch_stripe_errors
|
||||
def process_initial_upgrade(
|
||||
@@ -513,7 +517,7 @@ def process_initial_upgrade(
|
||||
realm = user.realm
|
||||
customer = update_or_create_stripe_customer(user, stripe_token=stripe_token)
|
||||
charge_automatically = stripe_token is not None
|
||||
free_trial = settings.FREE_TRIAL_DAYS not in (None, 0)
|
||||
free_trial = is_free_trial_offer_enabled()
|
||||
|
||||
if get_current_plan_by_customer(customer) is not None:
|
||||
# Unlikely race condition from two people upgrading (clicking "Make payment")
|
||||
|
||||
@@ -294,7 +294,10 @@ def login_or_register_remote_user(request: HttpRequest, result: ExternalAuthResu
|
||||
do_login(request, user_profile)
|
||||
|
||||
redirect_to = result.data_dict.get("redirect_to", "")
|
||||
if is_realm_creation is not None and settings.FREE_TRIAL_DAYS not in [None, 0]:
|
||||
if is_realm_creation is not None and settings.BILLING_ENABLED:
|
||||
from corporate.lib.stripe import is_free_trial_offer_enabled
|
||||
|
||||
if is_free_trial_offer_enabled():
|
||||
redirect_to = "{}?onboarding=true".format(reverse("initial_upgrade"))
|
||||
|
||||
redirect_to = get_safe_redirect_to(redirect_to, user_profile.realm.uri)
|
||||
|
||||
Reference in New Issue
Block a user