1/* global wc_cashfree_checkout_params */ 2jQuery(document).ready(initCashfreeCheckout); 3function 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}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.