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.

billing: Show success message after upgrade from free trial.

Aman Agrawal15d92225fd8e
diff --git a/web/src/billing/event_status.ts b/web/src/billing/event_status.ts
index a155c644650..6051d575204 100644
--- a/web/src/billing/event_status.ts
+++ b/web/src/billing/event_status.ts
@@ -144,12 +144,7 @@ export async function stripe_payment_intent_status_check(
return false;
case "succeeded":
if (response_data.payment_intent.event_handler!.status === "succeeded") {
- update_status_and_redirect(
- "/billing/?success_message=" +
- encodeURIComponent(
- "Your organization has been upgraded to Zulip Cloud Standard.",
- ),
- );
+ helpers.redirect_to_billing_with_successful_upgrade();
return true;
}
if (response_data.payment_intent.event_handler!.status === "failed") {
diff --git a/web/src/billing/helpers.ts b/web/src/billing/helpers.ts
index cb946427897..74f960c2dc2 100644
--- a/web/src/billing/helpers.ts
+++ b/web/src/billing/helpers.ts
@@ -152,3 +152,10 @@ export function set_tab(page: string): void {
export function is_valid_input(elem: JQuery<HTMLFormElement>): boolean {
return elem[0].checkValidity();
}
+
+export function redirect_to_billing_with_successful_upgrade(): void {
+ window.location.replace(
+ "/billing/?success_message=" +
+ encodeURIComponent("Your organization has been upgraded to Zulip Cloud Standard."),
+ );
+}
diff --git a/web/src/billing/upgrade.ts b/web/src/billing/upgrade.ts
index fa4887532e7..4ef22c9eb0a 100644
--- a/web/src/billing/upgrade.ts
+++ b/web/src/billing/upgrade.ts
@@ -98,7 +98,7 @@ export const initialize = (): void => {
`/billing/event_status?stripe_payment_intent_id=${response_data.stripe_payment_intent_id}`,
);
} else if (response_data.organization_upgrade_successful) {
- window.location.replace("/billing");
+ helpers.redirect_to_billing_with_successful_upgrade();
}
},
() => {