mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
stripe: Extract common helper function.
This commit is contained in:
@@ -640,6 +640,9 @@ class BillingSession(ABC):
|
|||||||
def on_paid_plan(self) -> bool:
|
def on_paid_plan(self) -> bool:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def sponsorship_org_type_key_helper(self, d: Any) -> int:
|
||||||
|
return d[1]["display_order"]
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None:
|
def add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None:
|
||||||
pass
|
pass
|
||||||
@@ -1972,9 +1975,6 @@ class RealmBillingSession(BillingSession):
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
def add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None:
|
def add_sponsorship_info_to_context(self, context: Dict[str, Any]) -> None:
|
||||||
def key_helper(d: Any) -> int:
|
|
||||||
return d[1]["display_order"]
|
|
||||||
|
|
||||||
context.update(
|
context.update(
|
||||||
realm_org_type=self.realm.org_type,
|
realm_org_type=self.realm.org_type,
|
||||||
sorted_org_types=sorted(
|
sorted_org_types=sorted(
|
||||||
@@ -1983,7 +1983,7 @@ class RealmBillingSession(BillingSession):
|
|||||||
for (org_type_name, org_type) in Realm.ORG_TYPES.items()
|
for (org_type_name, org_type) in Realm.ORG_TYPES.items()
|
||||||
if not org_type.get("hidden")
|
if not org_type.get("hidden")
|
||||||
),
|
),
|
||||||
key=key_helper,
|
key=self.sponsorship_org_type_key_helper,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user