billing: Pass numeric_inputs as an argument to create_ajax_request.

This commit is contained in:
Vishnu KS 2020-04-24 21:06:20 +05:30 committed by Tim Abbott
parent f1b1bf5a0d
commit f74e2b69f0
4 changed files with 5 additions and 7 deletions

View File

@ -127,7 +127,7 @@ run_test('create_ajax_request', () => {
assert.equal(state.form_input_section_show, 1);
};
helpers.create_ajax_request("/json/billing/upgrade", "autopay", {id: "stripe_token_id"});
helpers.create_ajax_request("/json/billing/upgrade", "autopay", {id: "stripe_token_id"}, ["licenses"]);
});

View File

@ -7,7 +7,7 @@ exports.initialize = function () {
image: '/static/images/logo/zulip-icon-128x128.png',
locale: 'auto',
token: function (stripe_token) {
helpers.create_ajax_request("/json/billing/sources/change", "cardchange", stripe_token = stripe_token);
helpers.create_ajax_request("/json/billing/sources/change", "cardchange", stripe_token);
},
});

View File

@ -1,4 +1,4 @@
exports.create_ajax_request = function (url, form_name, stripe_token = null) {
exports.create_ajax_request = function (url, form_name, stripe_token = null, numeric_inputs = []) {
const form = $("#" + form_name + "-form");
const form_loading_indicator = "#" + form_name + "_loading_indicator";
const form_input_section = "#" + form_name + "-input-section";
@ -6,8 +6,6 @@ exports.create_ajax_request = function (url, form_name, stripe_token = null) {
const form_error = "#" + form_name + "-error";
const form_loading = "#" + form_name + "-loading";
const numeric_inputs = ["licenses"];
loading.make_indicator($(form_loading_indicator),
{text: 'Processing ...', abs_positioned: true});
$(form_input_section).hide();

View File

@ -6,7 +6,7 @@ exports.initialize = () => {
image: '/static/images/logo/zulip-icon-128x128.png',
locale: 'auto',
token: function (stripe_token) {
helpers.create_ajax_request("/json/billing/upgrade", "autopay", stripe_token = stripe_token);
helpers.create_ajax_request("/json/billing/upgrade", "autopay", stripe_token, ["licenses"]);
},
});
@ -33,7 +33,7 @@ exports.initialize = () => {
return;
}
e.preventDefault();
helpers.create_ajax_request("/json/billing/upgrade", "invoice");
helpers.create_ajax_request("/json/billing/upgrade", "invoice", undefined, ["licenses"]);
});
const prices = {};