Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stripe: Extract function to get next plan for legacy customers.
Aman Agrawal121e5ad3dc73
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 33b494d5cfb..50a36028b38 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -829,9 +829,9 @@ class BillingSession(ABC):assert plan.end_date is not Nonereturn plan.end_date.strftime("%B %d, %Y")- def get_legacy_remote_server_next_plan_name(+ def get_legacy_remote_server_next_plan(self, customer: Customer- ) -> Optional[str]: # nocoverage+ ) -> Optional[CustomerPlan]: # nocoveragelegacy_plan = self.get_remote_server_legacy_plan(customer, CustomerPlan.SWITCH_PLAN_TIER_AT_PLAN_END)@@ -844,7 +844,15 @@ class BillingSession(ABC):customer=customer,billing_cycle_anchor=legacy_plan.end_date,status=CustomerPlan.NEVER_STARTED,- ).name+ )++ def get_legacy_remote_server_next_plan_name(+ self, customer: Customer+ ) -> Optional[str]: # nocoverage+ next_plan = self.get_legacy_remote_server_next_plan(customer)+ if next_plan is None:+ return None+ return next_plan.name@catch_stripe_errorsdef create_stripe_customer(self) -> Customer:@@ -1010,6 +1018,7 @@ class BillingSession(ABC):)plan.discount = new_discountplan.save(update_fields=["price_per_license", "discount"])+self.write_to_audit_log(event_type=AuditLogEventType.DISCOUNT_CHANGED,event_time=timezone_now(),