1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/resources/js/clients/payments/razorpay-aio.js

37 lines
958 B
JavaScript
Raw Normal View History

2021-10-07 18:04:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
2022-06-08 06:25:44 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-10-07 18:04:07 +02:00
*/
let options = JSON.parse(
document.querySelector('meta[name=razorpay-options]')?.content
);
2021-11-14 12:48:23 +01:00
options.handler = function (response) {
2021-10-07 18:04:07 +02:00
document.getElementById('razorpay_payment_id').value =
response.razorpay_payment_id;
document.getElementById('razorpay_signature').value =
response.razorpay_signature;
document.getElementById('server-response').submit();
};
2021-11-14 12:48:23 +01:00
options.modal = {
ondismiss: function () {
payNowButton.disabled = false;
},
};
2021-10-07 18:04:07 +02:00
let razorpay = new Razorpay(options);
2021-11-14 12:48:23 +01:00
let payNowButton = document.getElementById('pay-now');
2021-10-07 18:04:07 +02:00
2021-11-14 12:48:23 +01:00
payNowButton.onclick = function (event) {
payNowButton.disabled = true;
2021-10-07 18:04:07 +02:00
razorpay.open();
};