Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

corporate: Make is_sponsored_or_pending not abstract in BillingSession.

Lauryn Menard5eabd5170260
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index ca5337bc579..ca719b96d88 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -724,10 +724,6 @@ class BillingSession(ABC):
def is_sponsored(self) -> bool:
pass
- @abstractmethod
- def is_sponsored_or_pending(self, customer: Optional[Customer]) -> bool:
- pass
-
@abstractmethod
def get_sponsorship_request_session_specific_context(
self,
@@ -766,6 +762,11 @@ class BillingSession(ABC):
def get_metadata_for_stripe_update_card(self) -> Dict[str, Any]:
pass
+ def is_sponsored_or_pending(self, customer: Optional[Customer]) -> bool:
+ if (customer is not None and customer.sponsorship_pending) or self.is_sponsored():
+ return True
+ return False
+
@catch_stripe_errors
def create_stripe_customer(self) -> Customer:
stripe_customer_data = self.get_data_for_stripe_customer()
@@ -2324,12 +2325,6 @@ class RealmBillingSession(BillingSession):
def is_sponsored(self) -> bool:
return self.realm.plan_type == self.realm.PLAN_TYPE_STANDARD_FREE
- @override
- def is_sponsored_or_pending(self, customer: Optional[Customer]) -> bool:
- if (customer is not None and customer.sponsorship_pending) or self.is_sponsored():
- return True
- return False
-
@override
def get_metadata_for_stripe_update_card(self) -> Dict[str, Any]:
assert self.user is not None
@@ -2591,12 +2586,6 @@ class RemoteRealmBillingSession(BillingSession): # nocoverage
def is_sponsored(self) -> bool:
return self.remote_realm.plan_type == self.remote_realm.PLAN_TYPE_COMMUNITY
- @override
- def is_sponsored_or_pending(self, customer: Optional[Customer]) -> bool:
- if (customer is not None and customer.sponsorship_pending) or self.is_sponsored():
- return True
- return False
-
@override
def get_metadata_for_stripe_update_card(self) -> Dict[str, Any]:
return {
@@ -2868,11 +2857,6 @@ class RemoteServerBillingSession(BillingSession): # nocoverage
def is_sponsored(self) -> bool:
return self.remote_server.plan_type == self.remote_server.PLAN_TYPE_COMMUNITY
- @override
- def is_sponsored_or_pending(self, customer: Optional[Customer]) -> bool:
- # TBD
- return False
-
@override
def get_metadata_for_stripe_update_card(self) -> Dict[str, Any]:
return {