Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
upgrade: Provide billing_base_url in page_params.
Aman Agrawalbb7b0b673154
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 2ddf202a20e..c2f006fab83 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -551,6 +551,7 @@ class UpgradePageParams(TypedDict):demo_organization_scheduled_deletion_date: Optional[datetime]monthly_price: intseat_count: int+ billing_base_url: strclass UpgradePageSessionTypeSpecificContext(TypedDict):@@ -609,6 +610,11 @@ class BillingSession(ABC):def billing_session_url(self) -> str:pass+ @property+ @abstractmethod+ def billing_base_url(self) -> str:+ pass+@abstractmethoddef support_url(self) -> str:pass@@ -1499,6 +1505,7 @@ class BillingSession(ABC):tier, CustomerPlan.BILLING_SCHEDULE_MONTHLY, percent_off),"seat_count": seat_count,+ "billing_base_url": self.billing_base_url,},"payment_method": current_payment_method,"plan": "Zulip Cloud Standard",@@ -2008,6 +2015,11 @@ class RealmBillingSession(BillingSession):def billing_session_url(self) -> str:return self.realm.uri+ @override+ @property+ def billing_base_url(self) -> str:+ return ""+@overridedef support_url(self) -> str:# TODO: Refactor to not create an import cycle.@@ -2315,6 +2327,11 @@ class RemoteRealmBillingSession(BillingSession): # nocoveragedef billing_session_url(self) -> str:return f"{settings.EXTERNAL_URI_SCHEME}{settings.SELF_HOSTING_MANAGEMENT_SUBDOMAIN}.{settings.EXTERNAL_HOST}/realm/{self.remote_realm.uuid}"+ @override+ @property+ def billing_base_url(self) -> str:+ return f"/realm/{self.remote_realm.uuid}"+@overridedef support_url(self) -> str:return "TODO:not-implemented"@@ -2579,6 +2596,11 @@ class RemoteServerBillingSession(BillingSession): # nocoveragedef billing_session_url(self) -> str:return "TBD"+ @override+ @property+ def billing_base_url(self) -> str:+ return f"/server/${self.remote_server.uuid}"+@overridedef support_url(self) -> str:return "TODO:not-implemented"diff --git a/web/src/billing/helpers.ts b/web/src/billing/helpers.tsindex 3dcd1905d8c..06b3f9beb08 100644--- a/web/src/billing/helpers.ts+++ b/web/src/billing/helpers.ts@@ -179,14 +179,6 @@ export function get_event_status_url(): string {return "/json/billing/event/status";}-export function get_upgrade_page_card_update_session_url(): string {- const realm_uuid = get_realm_uuid_from_url();- if (realm_uuid) {- return `/json/realm/${realm_uuid}/upgrade/session/start_card_update_session`;- }- return "/json/upgrade/session/start_card_update_session";-}-export function get_upgrade_page_url(is_manual_license_management_upgrade_session: boolean | undefined,): string {diff --git a/web/src/billing/page_params.ts b/web/src/billing/page_params.tsindex 5497ddf4304..e0f03f1512c 100644--- a/web/src/billing/page_params.ts+++ b/web/src/billing/page_params.ts@@ -7,6 +7,7 @@ export const page_params: {annual_price: number;monthly_price: number;seat_count: number;+ billing_base_url: string;} = $("#page-params").data("params");if (!page_params) {diff --git a/web/src/billing/upgrade.ts b/web/src/billing/upgrade.tsindex d0a3d8cfd43..313b4858d31 100644--- a/web/src/billing/upgrade.ts+++ b/web/src/billing/upgrade.ts@@ -136,7 +136,7 @@ export const initialize = (): void => {$("#upgrade-add-card-button #upgrade-add-card-button-text").hide();$("#upgrade-add-card-button .loader").show();helpers.create_ajax_request(- helpers.get_upgrade_page_card_update_session_url(),+ `/json${page_params.billing_base_url}/upgrade/session/start_card_update_session`,"upgrade-cardchange",[],"POST",