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: Revise Customer and CustomerPlan(Offer) string methods.

Lauryn Menardfc1f9b4c75d9
diff --git a/corporate/models/customers.py b/corporate/models/customers.py
index b85d532e174..0638aeec338 100644
--- a/corporate/models/customers.py
+++ b/corporate/models/customers.py
@@ -58,11 +58,11 @@ class Customer(models.Model):
@override
def __str__(self) -> str:
if self.realm is not None:
- return f"{self.realm!r} (with stripe_customer_id: {self.stripe_customer_id})"
+ return f"{self.realm!r} (stripe: {self.stripe_customer_id})"
elif self.remote_realm is not None:
- return f"{self.remote_realm!r} (with stripe_customer_id: {self.stripe_customer_id})"
+ return f"{self.remote_realm!r} (stripe: {self.stripe_customer_id})"
else:
- return f"{self.remote_server!r} (with stripe_customer_id: {self.stripe_customer_id})"
+ return f"{self.remote_server!r} (stripe: {self.stripe_customer_id})"
def get_discounted_price_for_plan(self, plan_tier: int, schedule: int) -> int | None:
from corporate.models.plans import CustomerPlan
diff --git a/corporate/models/plans.py b/corporate/models/plans.py
index 229c5716502..dad39b21d3d 100644
--- a/corporate/models/plans.py
+++ b/corporate/models/plans.py
@@ -47,7 +47,7 @@ class CustomerPlanOffer(AbstractCustomerPlan):
@override
def __str__(self) -> str:
- return f"{self.name} (status: {self.get_plan_status_as_text()})"
+ return f"{self.name} for {self.customer!r} (status: {self.get_plan_status_as_text()})"
def get_plan_status_as_text(self) -> str:
return {
@@ -187,7 +187,7 @@ class CustomerPlan(AbstractCustomerPlan):
@override
def __str__(self) -> str:
- return f"{self.name} (status: {self.get_plan_status_as_text()})"
+ return f"{self.name} for {self.customer!r} (status: {self.get_plan_status_as_text()})"
@staticmethod
def name_from_tier(tier: int) -> str:
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 1e050253be9..ddaeb462ace 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -2512,7 +2512,7 @@ class StripeTest(StripeTestCase):
)
self.assertEqual(
m.output[0],
- "WARNING:corporate.stripe:Upgrade of <Realm: zulip 2> (with stripe_customer_id: cus_123) failed because of existing active plan.",
+ "WARNING:corporate.stripe:Upgrade of <Realm: zulip 2> (stripe: cus_123) failed because of existing active plan.",
)
self.assert_length(m.output, 1)
@@ -4419,7 +4419,7 @@ class StripeTest(StripeTestCase):
)
self.assertEqual(
m.output[0],
- "WARNING:corporate.stripe:Upgrade of <Realm: zulip 2> (with stripe_customer_id: cus_123) failed because of existing active plan.",
+ "WARNING:corporate.stripe:Upgrade of <Realm: zulip 2> (stripe: cus_123) failed because of existing active plan.",
)
self.assertEqual(
context.exception.error_description, "subscribing with existing subscription"