Files
zulip/static/js/billing/billing.js
Anders Kaseorg f3726db89a js: Normalize strings to double quotes.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:24 -07:00

39 lines
1.1 KiB
JavaScript

exports.initialize = function () {
helpers.set_tab("billing");
const stripe_key = $("#payment-method").data("key");
const card_change_handler = StripeCheckout.configure({ // eslint-disable-line no-undef
key: stripe_key,
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);
},
});
$("#update-card-button").on("click", (e) => {
const email = $("#payment-method").data("email");
card_change_handler.open({
name: "Zulip",
zipCode: true,
billingAddress: true,
panelLabel: "Update card",
email: email,
label: "Update card",
allowRememberMe: false,
});
e.preventDefault();
});
$("#change-plan-status").on("click", (e) => {
helpers.create_ajax_request("/json/billing/plan/change", "planchange", undefined, ["status"]);
e.preventDefault();
});
};
window.billing = exports;
$(() => {
exports.initialize();
});