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.

upgrade: Add required fields to upgrade a realm.

Aman Agrawal7d10b3dcf703
diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.html
index 0b781074af0..364065eec03 100644
--- a/templates/corporate/upgrade.html
+++ b/templates/corporate/upgrade.html
@@ -58,7 +58,7 @@
Zulip Cloud Free, our forever free plan, at any time.
</p>
{% endif %}
- <select name="payment-schedule" id="payment-schedule-select">
+ <select name="schedule" id="payment-schedule-select">
<option value="monthly" id="autopay_monthly_price"></option>
<option value="annual" id="autopay_annual_price_per_month"></option>
</select>
@@ -71,6 +71,9 @@
<input type="number" name="licenses" autocomplete="off" {% if not exempt_from_license_number_check %}min="{{ seat_count }}" value="{{ seat_count }}"{% endif %} autocomplete="off" id="manual_license_count" required/>
<div id="upgrade-licenses-change-error" class="alert alert-danger upgrade-page-error"></div>
</div>
+ <input type="hidden" name="license_management" value="manual" />
+ {% else %}
+ <input type="hidden" name="license_management" value="automatic" />
{% endif %}
<div class="input-box upgrade-page-field no-validation">
diff --git a/web/src/billing/upgrade.ts b/web/src/billing/upgrade.ts
index 2712d76ffb3..324755f8ccf 100644
--- a/web/src/billing/upgrade.ts
+++ b/web/src/billing/upgrade.ts
@@ -8,13 +8,7 @@ let selected_schedule = "monthly";
let current_license_count = page_params.seat_count;
export const initialize = (): void => {
- $("#add-card-button").on("click", (e) => {
- const license_management = $<HTMLInputElement>(
- "input[type=radio][name=license_management]:checked",
- ).val()!;
- if (!helpers.is_valid_input($(`#${CSS.escape(license_management)}_license_count`))) {
- return;
- }
+ $("#org-upgrade-button").on("click", (e) => {
e.preventDefault();
helpers.create_ajax_request("/json/billing/upgrade", "autopay", [], "POST", (response) => {
@@ -22,6 +16,7 @@ export const initialize = (): void => {
window.location.replace(response_data.stripe_session_url);
});
});
+
const prices: Prices = {
annual: page_params.annual_price * (1 - page_params.percent_off / 100),
monthly: page_params.monthly_price * (1 - page_params.percent_off / 100),