From a764f9ce25e2fed7c0ea886388e58e9a90f6c9d8 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Mon, 12 Feb 2024 15:39:45 +0530 Subject: [PATCH] corporate: Fix 'free_trial=True` for legacy customers during upgrade. Earlier, we were not setting `free_trial` = False for legacy customers in `do_upgrade`. This lead to a bug where customers were upgraded even before the payment was complete. 'process_initial_upgrade' was always getting called instead of 'setup_upgrade_payment_intent_and_charge'. This commit fixes the incorrect behaviour. --- corporate/lib/stripe.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py index 08df9216ba..ae20aa88de 100644 --- a/corporate/lib/stripe.py +++ b/corporate/lib/stripe.py @@ -1736,6 +1736,9 @@ class BillingSession(ABC): free_trial = False remote_server_legacy_plan = self.get_remote_server_legacy_plan(customer) + if remote_server_legacy_plan is not None: + # Free trial is not available for legacy customers. + free_trial = False should_schedule_upgrade_for_legacy_remote_server = ( remote_server_legacy_plan is not None and upgrade_request.remote_server_plan_start_date == "billing_cycle_end_date"