1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 07:33:04 +01:00
invoiceninja/resources/js/clients/payments/razorpay-aio.js
2022-06-08 14:25:44 +10:00

37 lines
958 B
JavaScript
Vendored

/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
let options = JSON.parse(
document.querySelector('meta[name=razorpay-options]')?.content
);
options.handler = function (response) {
document.getElementById('razorpay_payment_id').value =
response.razorpay_payment_id;
document.getElementById('razorpay_signature').value =
response.razorpay_signature;
document.getElementById('server-response').submit();
};
options.modal = {
ondismiss: function () {
payNowButton.disabled = false;
},
};
let razorpay = new Razorpay(options);
let payNowButton = document.getElementById('pay-now');
payNowButton.onclick = function (event) {
payNowButton.disabled = true;
razorpay.open();
};