PluginProbe
Cashfree for WooCommerce / 4.8.1
Cashfree for WooCommerce v4.8.1
4.8.1 4.8.0 trunk 1.0 1.2 4.2.1 4.2.2 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.5.0 4.5.1 All 42 releases
cashfree / assets / js / checkout.js

checkout.js in Cashfree for WooCommerce 4.8.1, at assets/js/checkout.js

41 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global wc_cashfree_checkout_params */
2 jQuery(document).ready(initCashfreeCheckout);
3 function initCashfreeCheckout() {
4 if(typeof wc_cashfree_checkout_params != 'undefined') {
5 const cashfree = Cashfree({
6 mode: wc_cashfree_checkout_params.environment,
7 });
8 if(wc_cashfree_checkout_params.order_in_context) {
9 let checkoutOptions = {
10 paymentSessionId: wc_cashfree_checkout_params.payment_session_id,
11 redirectTarget: "_modal",
12 };
13 cashfree.checkout(checkoutOptions).then((result) => {
14 let in_context_form;
15 if (result.error) {
16 // This will be true whenever user clicks on close icon inside the modal or any error happens during the payment
17 in_context_form = document.createElement('FORM');
18 in_context_form.method = 'POST';
19 in_context_form.action = wc_cashfree_checkout_params.callback_url;
20 document.body.appendChild(in_context_form);
21 in_context_form.submit();
22 }
23 if(result.paymentDetails){
24 // This will be called whenever the payment is completed irrespective of transaction status
25 in_context_form=document.createElement('FORM');
26 in_context_form.method='POST';
27 in_context_form.action=wc_cashfree_checkout_params.callback_url;
28 document.body.appendChild(in_context_form);
29 in_context_form.submit();
30 }
31 });
32 } else {
33 return cashfree.checkout({
34 paymentSessionId: wc_cashfree_checkout_params.payment_session_id,
35 redirectTarget: "_self",
36 platformName: "wc",
37 });
38 }
39 }
40
41 }