Thanks, yes, think they got around by using the radio buttons, of which i've already included along the lines of
but i think difference is that the opayo's js own file is looking at the submit event of the form (rather than a button click which i think square js looks at) so at the moment its being triggered without me actually having a chance to intercept it, using above code.Code:$('form[name="checkout_payment"]').submit(function(e) { if($('#pmt-opayo_pi').is(':checked') || document.getElementById('pmt-opayo_pi').checked == true || (document.querySelector('#pmt-opayo_pi').getAttribute('type') == 'hidden')) { e.preventDefault(); //alert("banana"); } });
from squares zen code where it appears they are playing with the button call for square js code.
Code:const cardButton = document.getElementById('card-button'); if (document.querySelector("#checkoutOneSubmit")) { formButton = document.querySelector("#checkoutOneSubmit"); zcLog2Console('found checkoutOneSubmit button!'); } else { console.log('using standard paymentSubmit button'); formButton = document.querySelector("#paymentSubmit"); } cardButton.addEventListener('click', async function (event) { await handlePaymentMethodSubmission(event, card); }); try { formButton.addEventListener('click', function (event) { if ((document.querySelector('#pmt-square_webPay').checked) || (document.querySelector('#pmt-square_webPay').getAttribute('type') == 'hidden')) { event.preventDefault(); jQuery("#card-button").click(); } }); } catch(e){ console.log('square is not going to work!'); console.log('form button not found! removing square'); document.querySelector('#card-container').remove(); document.querySelector('#pmt-square_webPay').parentElement.remove(); }


Reply With Quote

