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.

stripe: Use remote_billing_url for redirecting to sponsorship page.

Aman Agrawalcaf2b7da2691
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 0c6e0aa7d5b..6f6296ce0b9 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -1273,7 +1273,7 @@ class BillingSession(ABC):
customer = self.get_customer()
if self.is_sponsored_or_pending(customer):
- return reverse("sponsorship_request"), None
+ return f"{self.billing_session_url}/sponsorship", None
billing_page_url = reverse("billing_home")
if customer is not None and (get_current_plan_by_customer(customer) is not None):
@@ -1702,7 +1702,7 @@ class RemoteRealmBillingSession(BillingSession): # nocoverage
@override
@property
def billing_session_url(self) -> str:
- return "TBD"
+ return f"{settings.EXTERNAL_URI_SCHEME}{settings.SELF_HOSTING_MANAGEMENT_SUBDOMAIN}.{settings.EXTERNAL_HOST}/realm/{self.remote_realm.uuid}"
@override
def get_customer(self) -> Optional[Customer]:
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index c4a6ef443d9..d96808c514e 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -1839,7 +1839,7 @@ class StripeTest(StripeTestCase):
response = self.client_get("/upgrade/")
self.assertEqual(response.status_code, 302)
- self.assertEqual(response["Location"], "/sponsorship/")
+ self.assertEqual(response["Location"], "http://zulip.testserver/sponsorship")
response = self.client_get("/billing/")
self.assertEqual(response.status_code, 302)
@@ -1943,7 +1943,7 @@ class StripeTest(StripeTestCase):
user.realm.save()
response = self.client_get("/upgrade/")
self.assertEqual(response.status_code, 302)
- self.assertEqual(response["Location"], "/sponsorship/")
+ self.assertEqual(response["Location"], "http://zulip.testserver/sponsorship")
# Avoid contacting stripe as we only want to check redirects here.
with patch(