Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Use original FREE_TRIAL_DAYS for cloud free trials.
Aman Agrawalccd60bc7e26e
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 78a047b3d62..6656b3f99d9 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -3628,11 +3628,11 @@ def compute_plan_parameters(def get_free_trial_days() -> Optional[int]:- return settings.FREE_TRIAL_DAYS+ return settings.CLOUD_FREE_TRIAL_DAYSdef is_free_trial_offer_enabled() -> bool:- return settings.FREE_TRIAL_DAYS not in (None, 0)+ return settings.CLOUD_FREE_TRIAL_DAYS not in (None, 0)def ensure_customer_does_not_have_active_plan(customer: Customer) -> None:diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 4d0369c2fc2..0b3b4f09273 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -1033,7 +1033,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")self.login_user(user)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):response = self.client_get("/upgrade/")free_trial_end_date = self.now + timedelta(days=60)@@ -1253,7 +1253,7 @@ class StripeTest(StripeTestCase):self.login_user(user)free_trial_end_date = self.now + timedelta(days=60)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):response = self.client_get("/upgrade/")self.assert_in_success_response(@@ -1992,7 +1992,7 @@ class StripeTest(StripeTestCase):self.assertEqual(response.status_code, 302)self.assertEqual(response["Location"], "http://zulip.testserver/billing")- with self.settings(FREE_TRIAL_DAYS=30):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=30):response = self.client_get("/upgrade/")self.assertEqual(response.status_code, 302)self.assertEqual(response["Location"], "http://zulip.testserver/billing")@@ -2889,7 +2889,7 @@ class StripeTest(StripeTestCase):self.login_user(user)free_trial_end_date = self.now + timedelta(days=60)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):with time_machine.travel(self.now, tick=False):self.add_card_and_upgrade(user, schedule="monthly")plan = CustomerPlan.objects.get()@@ -2944,7 +2944,7 @@ class StripeTest(StripeTestCase):self.login_user(user)free_trial_end_date = self.now + timedelta(days=60)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):with time_machine.travel(self.now, tick=False):self.add_card_and_upgrade(user, schedule="annual")plan = CustomerPlan.objects.get()@@ -2996,7 +2996,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")free_trial_end_date = self.now + timedelta(days=60)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):with time_machine.travel(self.now, tick=False):self.local_upgrade(self.seat_count, True, CustomerPlan.BILLING_SCHEDULE_ANNUAL, False, True@@ -3048,7 +3048,7 @@ class StripeTest(StripeTestCase):self.login_user(user)free_trial_end_date = self.now + timedelta(days=60)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):with time_machine.travel(self.now, tick=False):self.local_upgrade(self.seat_count, True, CustomerPlan.BILLING_SCHEDULE_ANNUAL, False, True@@ -3159,7 +3159,7 @@ class StripeTest(StripeTestCase):self.login_user(user)free_trial_end_date = self.now + timedelta(days=60)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):with time_machine.travel(self.now, tick=False):self.local_upgrade(self.seat_count, True, CustomerPlan.BILLING_SCHEDULE_ANNUAL, False, Truediff --git a/docs/subsystems/billing.md b/docs/subsystems/billing.mdindex 1b476c66be4..4f8383c6246 100644--- a/docs/subsystems/billing.md+++ b/docs/subsystems/billing.md@@ -69,10 +69,10 @@ a few things to keep in mind while conducting these tests manually:Here are some flows to test when upgrading a Zulip organization:-- When free trials are not enabled, i.e. `FREE_TRIAL_DAYS` is not set+- When free trials are not enabled, i.e. `CLOUD_FREE_TRIAL_DAYS` is not setto any value in `dev_settings.py` (aka the default). You candouble-check that the setting is disabled by verifying- `./scripts/get-django-setting FREE_TRIAL_DAYS` returns 0.+ `./scripts/get-django-setting CLOUD_FREE_TRIAL_DAYS` returns 0.- Using a valid card number like `4242 4242 4242 4242`.- Using an invalid card number like `4000000000000341`, which will add the card@@ -84,7 +84,7 @@ Here are some flows to test when upgrading a Zulip organization:- Upgrade an organization when free trials are enabled. The freetrials setting has been (possibly permanently) disabled inproduction for some time now, so testing this code path is not a- priority. You can set `FREE_TRIAL_DAYS` to any number greater than+ priority. You can set `CLOUD_FREE_TRIAL_DAYS` to any number greater than`0` in `dev_settings.py` to enable free trials. There are twodifferent flows to test here:- Right after the organization is created by following the instructions in thediff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.pyindex d2c1b216481..4a869de14bb 100644--- a/zerver/tests/test_docs.py+++ b/zerver/tests/test_docs.py@@ -575,7 +575,7 @@ class PlansPageTest(ZulipTestCase):self.assert_in_success_response([current_plan, upgrade_to_standard], result)self.assert_not_in_success_response([sign_up_now, sponsorship_pending], result)- with self.settings(FREE_TRIAL_DAYS=60):+ with self.settings(CLOUD_FREE_TRIAL_DAYS=60):result = self.client_get("/plans/", subdomain="zulip")self.assert_in_success_response([current_plan, "Start 60-day free trial"], result)self.assert_not_in_success_response(diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex 79898531879..e4a600bb6e9 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -1754,7 +1754,7 @@ class RealmCreationTest(ZulipTestCase):self.assert_length(messages, message_count)self.assertIn(text, messages[0].content)- @override_settings(OPEN_REALM_CREATION=True, FREE_TRIAL_DAYS=30)+ @override_settings(OPEN_REALM_CREATION=True, CLOUD_FREE_TRIAL_DAYS=30)def test_create_realm_during_free_trial(self) -> None:password = "test"string_id = "custom-test"diff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex c279139123e..76bd50acccb 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -546,7 +546,7 @@ ARCHIVED_DATA_VACUUMING_DELAY_DAYS = 30# are available to all realms.BILLING_ENABLED = False-FREE_TRIAL_DAYS: Optional[int] = int(get_secret("free_trial_days", "0"))+CLOUD_FREE_TRIAL_DAYS: Optional[int] = int(get_secret("cloud_free_trial_days", "0"))# Custom message (supports HTML) to be shown in the navbar of landing pages. Used mainly for# making announcements.diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.pyindex 1028ce58f9e..e7846ff1ecd 100644--- a/zproject/test_extra_settings.py+++ b/zproject/test_extra_settings.py@@ -257,7 +257,7 @@ RATE_LIMITING_RULES: Dict[str, List[Tuple[int, int]]] = {"password_reset_form_by_email": [],}-FREE_TRIAL_DAYS: Optional[int] = None+CLOUD_FREE_TRIAL_DAYS: Optional[int] = NoneSCIM_CONFIG: Dict[str, SCIMConfigDict] = {"zulip": {