From 00f4f8cb04c90981f90cd323b6535aa5cf3ebb6f Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Mon, 4 Dec 2023 14:56:48 +0000 Subject: [PATCH] billing: Use PATCH requests for update plan for remote instances. This fixes the update requests for billing frequency and other requests not working on billing page for cloud customers. --- corporate/views/billing_page.py | 4 ++-- web/src/billing/billing.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.py index 9ecc0fef3a..fdb3dad5e9 100644 --- a/corporate/views/billing_page.py +++ b/corporate/views/billing_page.py @@ -218,8 +218,8 @@ def update_plan( return json_success(request) -@authenticated_remote_realm_management_endpoint @has_request_variables +@authenticated_remote_realm_management_endpoint def update_plan_for_remote_realm( request: HttpRequest, billing_session: RemoteRealmBillingSession, @@ -244,8 +244,8 @@ def update_plan_for_remote_realm( return json_success(request) -@authenticated_remote_server_management_endpoint @has_request_variables +@authenticated_remote_server_management_endpoint def update_plan_for_remote_server( request: HttpRequest, billing_session: RemoteServerBillingSession, diff --git a/web/src/billing/billing.ts b/web/src/billing/billing.ts index 586ba73f09..0242cc5985 100644 --- a/web/src/billing/billing.ts +++ b/web/src/billing/billing.ts @@ -29,7 +29,7 @@ export function create_update_current_cycle_license_request(): void { `/json${billing_base_url}/billing/plan`, "current-license-change", [], - "post", + "PATCH", () => { window.location.replace( `${billing_base_url}/billing/?success_message=` + @@ -54,7 +54,7 @@ export function create_update_next_cycle_license_request(): void { `/json${billing_base_url}/billing/plan`, "next-license-change", [], - "post", + "PATCH", () => { window.location.replace( `${billing_base_url}/billing/?success_message=` + @@ -193,7 +193,7 @@ export function initialize(): void { `/json${billing_base_url}/billing/plan`, "planchange", [], - "post", + "PATCH", () => window.location.replace( `${billing_base_url}/billing/?success_message=` + @@ -208,7 +208,7 @@ export function initialize(): void { `/json${billing_base_url}/billing/plan`, "planchange", [], - "post", + "PATCH", () => window.location.replace( `${billing_base_url}/billing/?success_message=` + @@ -225,7 +225,7 @@ export function initialize(): void { `/json${billing_base_url}/billing/plan`, "planchange", [], - "post", + "PATCH", () => window.location.replace( `${billing_base_url}/billing/?success_message=` + @@ -342,7 +342,7 @@ export function initialize(): void { }; e.preventDefault(); void $.ajax({ - type: "post", + type: "PATCH", url: `/json${billing_base_url}/billing/plan`, data, success() {