Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stripe: Extract method to get org_name.
Aman Agrawal130aecbf9e9a
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 94d996e8900..1dd6635bd57 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -749,6 +749,10 @@ class BillingSession(ABC):) -> Dict[str, Any]:pass+ @abstractmethod+ def org_name(self) -> str:+ pass+def get_data_for_stripe_payment_intent(self,customer: Customer,@@ -2803,6 +2807,7 @@ class BillingSession(ABC):"is_remotely_hosted": is_remotely_hosted,"sponsorship_plan_name": self.get_sponsorship_plan_name(customer, is_remotely_hosted),"plan_name": plan_name,+ "org_name": self.org_name(),}if customer is not None and customer.sponsorship_pending:@@ -3476,6 +3481,10 @@ class RealmBillingSession(BillingSession):def on_paid_plan(self) -> bool:return self.realm.plan_type in self.PAID_PLANS+ @override+ def org_name(self) -> str:+ return self.realm.name+@overridedef add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None:context.update(@@ -3489,7 +3498,6 @@ class RealmBillingSession(BillingSession):key=sponsorship_org_type_key_helper,),)- context["org_name"] = self.realm.name@overridedef get_sponsorship_request_session_specific_context(@@ -3895,6 +3903,10 @@ class RemoteRealmBillingSession(BillingSession):def on_paid_plan(self) -> bool: # nocoveragereturn self.remote_realm.plan_type in self.PAID_PLANS+ @override+ def org_name(self) -> str:+ return self.remote_realm.host+@overridedef add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None:context.update(@@ -3908,7 +3920,6 @@ class RemoteRealmBillingSession(BillingSession):key=sponsorship_org_type_key_helper,),)- context["org_name"] = self.remote_realm.host@overridedef get_sponsorship_request_session_specific_context(@@ -4332,6 +4343,10 @@ class RemoteServerBillingSession(BillingSession):def on_paid_plan(self) -> bool: # nocoveragereturn self.remote_server.plan_type in self.PAID_PLANS+ @override+ def org_name(self) -> str:+ return self.remote_server.hostname+@overridedef add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None: # nocoveragecontext.update(@@ -4345,7 +4360,6 @@ class RemoteServerBillingSession(BillingSession):key=sponsorship_org_type_key_helper,),)- context["org_name"] = self.remote_server.hostname@overridedef get_sponsorship_request_session_specific_context(diff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.pyindex 2d443ad13e7..ebfe8118e6f 100644--- a/corporate/views/billing_page.py+++ b/corporate/views/billing_page.py@@ -57,7 +57,7 @@ def billing_page(context: Dict[str, Any] = {"admin_access": user.has_billing_access,"has_active_plan": False,- "org_name": user.realm.name,+ "org_name": billing_session.org_name(),"billing_base_url": "",}@@ -102,7 +102,7 @@ def remote_realm_billing_page(# We wouldn't be here if user didn't have access."admin_access": billing_session.has_billing_access(),"has_active_plan": False,- "org_name": billing_session.remote_realm.name,+ "org_name": billing_session.org_name(),"billing_base_url": billing_session.billing_base_url,}@@ -160,7 +160,7 @@ def remote_server_billing_page(# We wouldn't be here if user didn't have access."admin_access": billing_session.has_billing_access(),"has_active_plan": False,- "org_name": billing_session.remote_server.hostname,+ "org_name": billing_session.org_name(),"billing_base_url": billing_session.billing_base_url,}