1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/resources/js/clients/payments/razorpay-aio.js
2021-10-07 18:04:07 +02:00

30 lines
826 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://opensource.org/licenses/AAL
*/
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();
};
let razorpay = new Razorpay(options);
document.getElementById('pay-now').onclick = function(event) {
event.target.parentElement.disabled = true;
razorpay.open();
};