Changeset 3458643
- Timestamp:
- 02/11/2026 05:53:41 AM (4 weeks ago)
- Location:
- payplus-payment-gateway/trunk
- Files:
-
- 8 edited
-
CHANGELOG.md (modified) (1 diff)
-
assets/js/checkout.js (modified) (11 diffs)
-
assets/js/checkout.min.js (modified) (1 diff)
-
block/dist/js/woocommerce-blocks/blocks.js (modified) (1 diff)
-
block/dist/js/woocommerce-blocks/blocks.min.js (modified) (1 diff)
-
hashes.json (modified) (3 diffs)
-
payplus-payment-gateway.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
payplus-payment-gateway/trunk/CHANGELOG.md
r3457789 r3458643 2 2 3 3 All notable changes to this project will be documented in this file. 4 5 ## [8.0.3] - 11-02-2026 - (FireBlocked) 6 7 - Fix - Firefox: redirect to thank-you page from payment iframe (parent performs redirect when iframe cannot). 4 8 5 9 ## [8.0.2] - 10-02-2026 - (Zenitsu) -
payplus-payment-gateway/trunk/assets/js/checkout.js
r3457789 r3458643 50 50 jQuery(document.body).on('updated_checkout', function() { 51 51 checkAndHideHostedFieldsIfMissing(); 52 }); 53 54 // Firefox blocks cross-origin iframe from navigating top window. When PayPlus iframe sends 55 // postMessage with redirect URL (or thank-you page loads in iframe), parent performs the redirect. 56 window.addEventListener('message', function(e) { 57 if (!e.data || e.data.type !== 'payplus_redirect' || !e.data.url) { 58 return; 59 } 60 try { 61 var u = new URL(e.data.url, window.location.origin); 62 if (u.origin === window.location.origin) { 63 window.location.href = e.data.url; 64 } 65 } catch (err) { 66 // ignore invalid URL 67 } 52 68 }); 53 69 … … 103 119 if (firstTime) { 104 120 firstTime = false; 105 console.log($hostedDiv.parent().attr("class"));106 121 // Add save token checkbox to hosted fields container // 107 122 var $checkbox = $( … … 977 992 typeof hostedPayload.more_info === 'number' 978 993 ) { 979 console.log(hostedPayload.more_info);980 981 994 // Proceed with payment submission 982 995 overlay(); … … 1231 1244 } 1232 1245 }, 1233 error: function (jqXHR) { 1234 if (wc_checkout_params.debug_mode) { 1235 /* jshint devel: true */ 1236 console.log(jqXHR.responseText); 1237 } 1246 error: function () { 1238 1247 }, 1239 1248 dataType: "html", … … 1330 1339 } 1331 1340 1332 // Debug: Log selected payment method on change1333 1341 $(document.body).on('change', 'input[name="payment_method"]', function() { 1334 1342 var selectedMethod = $('input[name="payment_method"]:checked').val(); 1335 console.log('Payment method changed to:', selectedMethod);1336 1337 1343 // When hosted fields is selected, ensure its payment box is visible 1338 1344 if (selectedMethod === 'payplus-payment-gateway-hostedfields') { … … 1341 1347 }); 1342 1348 1343 // Debug: Log payment info when place order is clicked1344 1349 $(document.body).on('click', '#place_order', function(e) { 1345 1350 var selectedToken = $('input[name="wc-payplus-payment-gateway-payment-token"]:checked').val(); 1346 1351 var $hostedFieldsInput = $('input#payment_method_payplus-payment-gateway-hostedfields'); 1347 1352 var $mainGatewayInput = $('input#payment_method_payplus-payment-gateway'); 1348 1353 1349 1354 // If a saved token is selected (not "new") and hosted fields is checked, switch to main gateway 1350 1355 if ($hostedFieldsInput.is(':checked') && selectedToken && selectedToken !== 'new') { 1351 console.log('INTERCEPTING: Forcing main gateway for token payment');1352 1353 // Check if main gateway exists1354 1356 if ($mainGatewayInput.length === 0) { 1355 console.error('Main gateway not found! Cannot process token payment.');1356 1357 alert('Error: Payment method not available for saved cards. Please contact support.'); 1357 1358 e.preventDefault(); 1358 1359 return false; 1359 1360 } 1360 1361 // Force main gateway selection1362 1361 $mainGatewayInput.prop('checked', true); 1363 1362 $hostedFieldsInput.prop('checked', false); 1364 1363 } 1365 1366 // Log after our changes1367 var selectedMethod = $('input[name="payment_method"]:checked').val();1368 var usingToken = $('body').attr('data-payplus-using-token');1369 console.log('=== PLACE ORDER CLICKED ===');1370 console.log('Selected payment method:', selectedMethod);1371 console.log('Selected token:', selectedToken);1372 console.log('Using token flag:', usingToken);1373 console.log('===========================');1374 1364 }); 1375 1365 … … 1381 1371 var $mainGatewayLi = $('.payment_method_payplus-payment-gateway'); 1382 1372 var $mainGatewayInput = $('input#payment_method_payplus-payment-gateway'); 1383 1384 console.log('Token selection changed to:', selectedValue); 1385 console.log('Hosted fields checked:', $hostedFieldsInput.is(':checked')); 1386 1373 1387 1374 if ($hostedFieldsInput.is(':checked')) { 1388 1375 if (selectedValue !== 'new') { … … 1398 1385 $('.payment_method_payplus-payment-gateway-hostedfields').before(mainGatewayHtml); 1399 1386 $mainGatewayInput = $('input#payment_method_payplus-payment-gateway'); 1400 console.log('Main gateway added dynamically');1401 1387 } else { 1402 // Main gateway exists, just ensure it's hidden1403 1388 $mainGatewayLi.css('display', 'none'); 1404 console.log('Main gateway already exists, hiding it');1405 1389 } 1406 1407 // Select the main gateway input (this will be used for processing)1408 1390 $mainGatewayInput.prop('checked', true); 1409 // Do NOT set hosted fields back to checked - let main gateway stay selected for processing1410 1411 // Mark that we're using a saved token1412 1391 $('body').attr('data-payplus-using-token', 'yes'); 1413 console.log('Switched to main gateway for token processing');1414 1392 } else { 1415 // "Use a new payment method" selected - use hosted fields1416 1393 $hostedFieldsInput.prop('checked', true); 1417 1394 $('body').attr('data-payplus-using-token', 'no'); 1418 console.log('Using hosted fields for new payment method');1419 1395 } 1420 1396 } … … 1447 1423 $tokenChecked.prop('checked', false); 1448 1424 $('input#wc-payplus-payment-gateway-payment-token-new').prop('checked', true).trigger('change'); 1449 console.log('PayPlus: Detected iframe interaction, switched to new payment method');1450 1425 } 1451 1426 } … … 1646 1621 Object.keys(payplus_script_checkout.multiPassIcons).length > 0 1647 1622 ) { 1648 console.log("isMultiPass");1649 1623 const multiPassIcons = payplus_script_checkout.multiPassIcons; 1650 1624 … … 1674 1648 image.style.opacity = 1; 1675 1649 }, 500); 1676 } else {1677 console.log("Image or new source not found.");1678 1650 } 1679 1651 } -
payplus-payment-gateway/trunk/assets/js/checkout.min.js
r3457789 r3458643 1 jQuery(function(e){if("undefined"==typeof wc_checkout_params)return!1;let t=payplus_script_checkout.hostedFieldsIsMain,o=payplus_script_checkout.iframeAutoHeight,a="payment_method_payplus-payment-gateway-hostedfields";var n=jQuery("body > div.container.hostedFields");let c=!0;e.blockUI.defaults.overlayCSS.cursor="default";let i=Object.keys(payplus_script_checkout.hasSavedTokens);function s(){if(!(jQuery(".pp_iframe").length>0||jQuery(".pp_iframe_h").length>0||jQuery("#pp_iframe").length>0)){const e=jQuery(".payment_method_payplus-payment-gateway-hostedfields");if(e.length>0){e.hide(),jQuery(".payment_box.payment_method_payplus-payment-gateway-hostedfields").hide();const t=jQuery("input#payment_method_payplus-payment-gateway-hostedfields");t.is(":checked")&&jQuery("input#payment_method_payplus-payment-gateway").prop("checked",!0).trigger("change"),t.prop("disabled",!0)}}}s(),setTimeout(s,100),setTimeout(s,500),jQuery(document.body).on("updated_checkout",function(){s()});var r={updateTimer:!1,dirtyInput:!1,selectedPaymentMethod:!1,xhr:!1,$order_review:e("#order_review"),$checkout_form:e("form.checkout"),init:function(){e(document.body).on("update_checkout",this.update_checkout),e(document.body).on("init_checkout",this.init_checkout),this.$checkout_form.on("click",'input[name="payment_method"]',this.payment_method_selected),e(document.body).hasClass("woocommerce-order-pay")&&(this.$order_review.on("click",'input[name="payment_method"]',this.payment_method_selected),this.$order_review.on("submit",this.submitOrder),this.$order_review.attr("novalidate","novalidate")),this.$checkout_form.attr("novalidate","novalidate"),this.$checkout_form.on("submit",this.submit),this.$checkout_form.on("input validate change",".input-text, select, input:checkbox",this.validate_field),this.$checkout_form.on("update",this.trigger_update_checkout),this.$checkout_form.on("change",'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address input, .update_totals_on_change select, .update_totals_on_change input[type="radio"], .update_totals_on_change input[type="checkbox"]',this.trigger_update_checkout),this.$checkout_form.on("change",".address-field select",this.input_changed),this.$checkout_form.on("change",".address-field input.input-text, .update_totals_on_change input.input-text",this.maybe_input_changed),this.$checkout_form.on("keydown",".address-field input.input-text, .update_totals_on_change input.input-text",this.queue_update_checkout),this.$checkout_form.on("change","#ship-to-different-address input",this.ship_to_different_address),this.$checkout_form.find("#ship-to-different-address input").trigger("change"),this.init_payment_methods(),"1"===wc_checkout_params.is_checkout&&e(document.body).trigger("init_checkout"),"yes"===wc_checkout_params.option_guest_checkout&&e("input#createaccount").on("change",this.toggle_create_account).trigger("change")},init_payment_methods:function(){var t=e(".woocommerce-checkout").find('input[name="payment_method"]');1===t.length&&t.eq(0).hide(),r.selectedPaymentMethod&&e("#"+r.selectedPaymentMethod).prop("checked",!0),0===t.filter(":checked").length&&t.eq(0).prop("checked",!0);var o=t.filter(":checked").eq(0).prop("id");t.length>1&&e('div.payment_box:not(".'+o+'")').filter(":visible").slideUp(0),t.filter(":checked").eq(0).trigger("click")},get_payment_method:function(){return r.$checkout_form.find('input[name="payment_method"]:checked').val()},payment_method_selected:function(t){if(h(!0),t.stopPropagation(),e(".payment_methods input.input-radio").length>1){var o=e("div.payment_box."+e(this).attr("ID")),a=e(this).is(":checked");a&&!o.is(":visible")&&(e("div.payment_box").filter(":visible").slideUp(230),a&&o.slideDown(230))}e(this).data("order_button_text")?e("#place_order").text(e(this).data("order_button_text")):e("#place_order").text(e("#place_order").data("value"));var n=e('.woocommerce-checkout input[name="payment_method"]:checked').attr("id");n!==r.selectedPaymentMethod&&e(document.body).trigger("payment_method_selected"),r.selectedPaymentMethod=n},toggle_create_account:function(){e("div.create-account").hide(),e(this).is(":checked")&&(e("#account_password").val("").trigger("change"),e("div.create-account").slideDown())},init_checkout:function(){e(document.body).trigger("update_checkout")},maybe_input_changed:function(e){r.dirtyInput&&r.input_changed(e)},input_changed:function(e){r.dirtyInput=e.target,r.maybe_update_checkout()},queue_update_checkout:function(e){if(9===(e.keyCode||e.which||0))return!0;r.dirtyInput=this,r.reset_update_checkout_timer(),r.updateTimer=setTimeout(r.maybe_update_checkout,"1000")},trigger_update_checkout:function(){r.reset_update_checkout_timer(),r.dirtyInput=!1,e(document.body).trigger("update_checkout")},maybe_update_checkout:function(){var t=!0;if(e(r.dirtyInput).length){var o=e(r.dirtyInput).closest("div").find(".address-field.validate-required");o.length&&o.each(function(){""===e(this).find("input.input-text").val()&&(t=!1)})}t&&r.trigger_update_checkout()},ship_to_different_address:function(){e("div.shipping_address").hide(),e(this).is(":checked")&&e("div.shipping_address").slideDown()},reset_update_checkout_timer:function(){clearTimeout(r.updateTimer)},is_valid_json:function(e){try{var t=JSON.parse(e);return t&&"object"==typeof t}catch(e){return!1}},validate_field:function(t){var o=e(this),a=o.closest(".form-row"),n=!0,c=a.is(".validate-required"),i=a.is(".validate-email"),s=a.is(".validate-phone"),r="",p=t.type;"input"===p&&a.removeClass("woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-invalid-phone woocommerce-validated"),"validate"!==p&&"change"!==p||(c&&("checkbox"!==o.attr("type")||o.is(":checked")?""===o.val()&&(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"),n=!1):(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"),n=!1)),i&&o.val()&&((r=new RegExp(/^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i)).test(o.val())||(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-email woocommerce-invalid-phone"),n=!1)),s&&(r=new RegExp(/[\s\#0-9_\-\+\/\(\)\.]/g),0<o.val().replace(r,"").length&&(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-phone"),n=!1)),n&&a.removeClass("woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-invalid-phone").addClass("woocommerce-validated"))},update_checkout:function(e,t){r.reset_update_checkout_timer(),r.updateTimer=setTimeout(r.update_checkout_action,"5",t)},update_checkout_action:function(o){if(r.xhr&&r.xhr.abort(),0!==e("form.checkout").length){o=void 0!==o?o:{update_shipping_method:!0};var s=e("#billing_country").val(),p=e("#billing_state").val(),d=e(":input#billing_postcode").val(),u=e("#billing_city").val(),l=e(":input#billing_address_1").val(),m=e(":input#billing_address_2").val(),h=s,_=p,y=d,f=u,g=l,k=m,v=e(r.$checkout_form).find(".address-field.validate-required:visible"),w=!0;v.length&&v.each(function(){""===e(this).find(":input").val()&&(w=!1)}),e("#ship-to-different-address").find("input").is(":checked")&&(h=e("#shipping_country").val(),_=e("#shipping_state").val(),y=e(":input#shipping_postcode").val(),f=e("#shipping_city").val(),g=e(":input#shipping_address_1").val(),k=e(":input#shipping_address_2").val());var b={security:wc_checkout_params.update_order_review_nonce,payment_method:r.get_payment_method(),country:s,state:p,postcode:d,city:u,address:l,address_2:m,s_country:h,s_state:_,s_postcode:y,s_city:f,s_address:g,s_address_2:k,has_full_address:w,post_data:e("form.checkout").serialize()};if(!1!==o.update_shipping_method){var F={};e('select.shipping_method, input[name^="shipping_method"][type="radio"]:checked, input[name^="shipping_method"][type="hidden"]').each(function(){F[e(this).data("index")]=e(this).val()}),b.shipping_method=F}e(".woocommerce-checkout-payment, .woocommerce-checkout-review-order-table").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),r.xhr=e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","update_order_review"),data:b,success:function(o){if(o&&!0===o.reload)return void window.location.reload();e(".woocommerce-NoticeGroup-updateOrderReview").remove();var s=e("#terms").prop("checked"),p={};if(e(".payment_box :input").each(function(){var t=e(this).attr("id");t&&(-1!==e.inArray(e(this).attr("type"),["checkbox","radio"])?p[t]=e(this).prop("checked"):p[t]=e(this).val())}),payplus_script_checkout.isHostedFields&&0===i.length&&payplus_script_checkout.hidePPGateway){const e=function(e,t){const o=document.createElement("div");o.innerHTML=e;o.querySelectorAll(`.${t}`).forEach(e=>{e.remove()});return o.innerHTML}(o.fragments[".woocommerce-checkout-payment"],"wc_payment_method.payment_method_payplus-payment-gateway");o.fragments[".woocommerce-checkout-payment"]=e}e(".hostedFields").prop("outerHTML");o&&o.fragments&&(e.each(o.fragments,function(t,o){if(!r.fragments||r.fragments[t]!==o){e(t).replaceWith(o),payplus_script_checkout.isSubscriptionOrder&&e(".wc_payment_methods.payment_methods.methods .wc_payment_method").each(function(){e(this).attr("class").split(/\s+/).forEach(function(t){payplus_script_checkout.isLoggedIn?t.startsWith("payment_method_payplus-payment-gateway-")&&"payment_method_payplus-payment-gateway-hostedfields"!==t&&e(this).remove():t.startsWith("payment_method_payplus-payment-gateway-")&&e(this).remove()}.bind(this))}),document.querySelector("#payplus-checkout-image-div")||function(){if(void 0!==payplus_script_checkout?.customIcons[0]&&payplus_script_checkout?.customIcons[0]?.length>0){var t=e("<div></div>",{class:"payplus-checkout-image-container",id:"payplus-checkout-image-div",style:"display: flex;flex-wrap: wrap;justify-content: center;"});e.each(payplus_script_checkout.customIcons,function(o,a){var n=e("<img>",{src:a,class:"payplus-checkout-image",alt:"Image "+(o+1),style:"max-width: 100%; max-height:35px;object-fit: contain;"});t.append(n)}),e("div.payment_method_payplus-payment-gateway").prepend(t)}}();!function(){const e=document.querySelector("#payment_method_payplus-payment-gateway-multipass");if(e&&Object.keys(payplus_script_checkout.multiPassIcons).length>0){console.log("isMultiPass");const n=payplus_script_checkout.multiPassIcons;function t(e){let t=document.querySelectorAll("img");for(let o of t)if(o.src.includes(e))return o;return null}function o(e,t){e&&t?(e.style.height="32px",e.style.width="32px",e.style.transition="opacity 0.5s",e.style.opacity=0,setTimeout(()=>{e.src=t,e.style.opacity=1},500)):console.log("Image or new source not found.")}if(e){let c=t("multipassLogo.png");if(c){c.src;let i=0;const s=Object.keys(n).map(e=>n[e]);function a(){const e=s[i];o(c,e),i=(i+1)%s.length,Object.keys(payplus_script_checkout.multiPassIcons).length>1&&setTimeout(a,2e3)}a()}}}}()}e(t).unblock(),"undefined"!=typeof newPpShippingMethods&&createNewShippingMethods()}),payplus_script_checkout.isHostedFields&&h(a,t),r.fragments=o.fragments,"pp_iframe_h"===n.parent().attr("class")&&function(){if(payplus_script_checkout.isHostedFields){if(!(jQuery(".pp_iframe").length>0||jQuery(".pp_iframe_h").length>0))return jQuery(".payment_method_payplus-payment-gateway-hostedfields").hide(),void(jQuery("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")&&jQuery("input#payment_method_payplus-payment-gateway").prop("checked",!0).trigger("change"));if(c){c=!1,console.log(n.parent().attr("class"));var o=e('<p class="hf-save form-row"><label for="save_token_checkbox"><input type="checkbox" name="wc-save-token" id="save_token_checkbox" value="1" style="margin:0 10px 0 10px;"/> '+payplus_script_checkout.saveCreditCard+"</label></p>");payplus_script_checkout.isLoggedIn&&payplus_script_checkout.isSavingCerditCards&&n.append(o),t?setTimeout(function(){e("input#"+a).prop("checked",!0),e("div.container.hostedFields").show()},1e3):setTimeout(function(){e(".payment_method_payplus-payment-gateway").css("display","block"),e("input#"+a).removeAttr("checked"),e(".container.hostedFields").hide(),e(".payment_box.payment_method_payplus-payment-gateway-hostedfields").hide(),e("input#payment_method_payplus-payment-gateway").prop("checked",!0)},1e3)}e(document).on("change",'input[name="payment_method"]',function(){e("input#"+a).is(":checked")?e("div.container.hostedFields").show():e(".container.hostedFields").hide()})}}());let d=!1;if(d)return;d=!0;var u=e('input[name="shipping_method[0]"]:checked').closest("li").find("label").text();""===u&&(u=e('input[name="shipping_method[0]"]').closest("li").find("label").text());var l=u.match(/(\$|₪)\s*([0-9.,]+)|([0-9.,]+)\s*(\$|₪)/);let m=0;if(l){l[1]||l[4];m=l[2]||l[3]}function h(t,o){o&&(e(".woocommerce-SavedPaymentMethods-new").hide(),e(".woocommerce-SavedPaymentMethods-saveNew").hide()),setTimeout(function(){if(e("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")){e(".container.hostedFields").show();const t=document.querySelector(".pp_iframe_h");t&&(t.style.display="block")}},2e3);var a=jQuery("#"+t),c=jQuery(".pp_iframe_h"),i=jQuery(".wc_payment_method."+t);let s=n.find(".hf-main").first();a.length&&c.length&&n.length&&(payplus_script_checkout.hostedFieldsWidth&&s.attr("style",function(e,t){return"width: "+payplus_script_checkout.hostedFieldsWidth+"% !important;"+(t?" "+t:"")}),c.append(n),i.append(c))}if(payplus_script_checkout.isHostedFields&&e(document.body).on("updated_checkout",function(){h(a,t)}),s&&e("#terms").prop("checked",!0),e.isEmptyObject(p)||e(".payment_box :input").each(function(){var t=e(this).attr("id");t&&(-1!==e.inArray(e(this).attr("type"),["checkbox","radio"])?e(this).prop("checked",p[t]).trigger("change"):(-1!==e.inArray(e(this).attr("type"),["select"])||null!==e(this).val()&&0===e(this).val().length)&&e(this).val(p[t]).trigger("change"))}),o&&"failure"===o.result){var _=e("form.checkout");e(".woocommerce-error, .woocommerce-message").remove(),o.messages?_.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-updateOrderReview">'+o.messages+"</div>"):_.prepend(o),_.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),r.scroll_to_notices()}r.init_payment_methods(),e(document.body).trigger("updated_checkout",[o])}})}},handleUnloadEvent:function(e){if(-1===navigator.userAgent.indexOf("MSIE")&&!document.documentMode)return!0;e.preventDefault()},attachUnloadEventsOnSubmit:function(){e(window).on("beforeunload",this.handleUnloadEvent)},detachUnloadEventsOnSubmit:function(){e(window).off("beforeunload",this.handleUnloadEvent)},blockOnSubmit:function(t){1!==t.data("blockUI.isBlocked")&&(t.block({message:null,overlayCSS:{top:0,height:"100%",background:"#fff",opacity:.6}}),e(".blockUI.blockOverlay").css("position","fixed"))},submitOrder:function(){r.blockOnSubmit(e(this))},submit:function(){r.reset_update_checkout_timer();var t=e(this);return t.is(".processing")||!1!==t.triggerHandler("checkout_place_order")&&!1!==t.triggerHandler("checkout_place_order_"+r.get_payment_method())&&(t.addClass("processing"),r.blockOnSubmit(t),r.attachUnloadEventsOnSubmit(),e.ajaxSetup({dataFilter:function(e,t){if("json"!==t)return e;if(r.is_valid_json(e))return e;var o=e.match(/{"result.*}/);return null===o||r.is_valid_json(o[0])&&(e=o[0]),e}}),e.ajax({type:"POST",url:wc_checkout_params.checkout_url,data:t.serialize(),dataType:"json",success:function(o){if("hostedFields"===o.method)jQuery.ajax({type:"post",dataType:"json",url:payplus_script_checkout.ajax_url,data:{action:"get-hosted-payload",_ajax_nonce:payplus_script_checkout.frontNonce},success:function(e){const t=JSON.parse(e.data.hostedPayload);JSON.parse(e.data.hostedResponse);t.more_info&&!isNaN(t.more_info)&&"number"==typeof t.more_info?(console.log(t.more_info),overlay(),jQuery(".blocks-payplus_loader_hosted").fadeIn(),r.$checkout_form.removeClass("processing").unblock(),hf.SubmitPayment()):(window.onbeforeunload=null,window.removeEventListener("beforeunload",r.detachUnloadEventsOnSubmit()),alert("The payment page has expired, refresh the page to continue"),location.reload())}});else{if(r.detachUnloadEventsOnSubmit(),o.payplus_iframe&&"success"===o.result)return r.$checkout_form.removeClass("processing").unblock(),"samePageIframe"==o.viewMode?function(t){e(".alertify").remove();const o=new URL(window.location.href);o.searchParams.set("payplus-iframe","1"),window.history.pushState({},"",o);const a=document.querySelector(".pp_iframe"),n=a.getAttribute("data-height");a.innerHTML="",a.append(f(t,"100%",n)),e("#closeFrame").on("click",function(e){e.preventDefault(),a.style.display="none"}),e("#place_order").prop("disabled",!0),payplus_script_checkout.payplus_mobile&&e("html, body").animate({scrollTop:e(".place-order").offset().top});y()}(o.payplus_iframe.data.payment_page_link):"popupIframe"==o.viewMode&&function(e,t){let o=window.innerWidth;o<568&&(t="100%");alertify.popupIframePaymentPage||alertify.dialog("popupIframePaymentPage",function(){return{main:function(e){this.message=f(e,"100%",t),y()},setup:function(){return{options:{autoReset:!1,overflow:!1,maximizable:!1,movable:!1,frameless:!0,transition:"fade"},focus:{element:0}}},prepare:function(){this.setContent(this.message)},hooks:{onshow:function(){this.elements.dialog.style.maxWidth="100%",this.elements.dialog.style.width=o>768?payplus_script_checkout.iframeWidth||"40%":"98%",this.elements.dialog.style.height=o>568?"82%":"100%",this.elements.content.style.top="25px"}}}});alertify.popupIframePaymentPage(e)}(o.payplus_iframe.data.payment_page_link,700),!0;try{if("success"!==o.result||!1===t.triggerHandler("checkout_place_order_success",o))throw"failure"===o.result?"Result failure":"Invalid response";-1===o.redirect.indexOf("https://")||-1===o.redirect.indexOf("http://")?window.location=o.redirect:window.location=decodeURI(o.redirect)}catch(t){if(!0===o.reload)return void window.location.reload();!0===o.refresh&&e(document.body).trigger("update_checkout"),o.messages?r.submit_error(o.messages):r.submit_error('<div class="woocommerce-error">'+wc_checkout_params.i18n_checkout_error+"</div>")}}},error:function(e,t,o){r.detachUnloadEventsOnSubmit(),r.submit_error('<div class="woocommerce-error">'+o+"</div>")}})),!1},submit_error:function(t){e(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),r.$checkout_form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+t+"</div>"),r.$checkout_form.removeClass("processing").unblock(),r.$checkout_form.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),r.scroll_to_notices(),e(document.body).trigger("checkout_error",[t])},scroll_to_notices:function(){var t=e(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");t.length||(t=e(".form.checkout")),e.scroll_to_notices(t)}},p={init:function(){e(document.body).on("click","a.showcoupon",this.show_coupon_form),e(document.body).on("click",".woocommerce-remove-coupon",this.remove_coupon),e("form.checkout_coupon").hide().on("submit",this.submit)},show_coupon_form:function(){return e(".checkout_coupon").slideToggle(400,function(){e(".checkout_coupon").find(":input:eq(0)").trigger("focus")}),!1},submit:function(){var t=e(this);if(t.is(".processing"))return!1;t.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o={security:wc_checkout_params.apply_coupon_nonce,coupon_code:t.find('input[name="coupon_code"]').val()};return e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:o,success:function(a){e(".woocommerce-error, .woocommerce-message").remove(),t.removeClass("processing").unblock(),a&&(t.before(a),t.slideUp(),e(document.body).trigger("applied_coupon_in_checkout",[o.coupon_code]),e(document.body).trigger("update_checkout",{update_shipping_method:!1}))},dataType:"html"}),!1},remove_coupon:function(t){t.preventDefault();var o=e(this).parents(".woocommerce-checkout-review-order"),a=e(this).data("coupon");o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={security:wc_checkout_params.remove_coupon_nonce,coupon:a};e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_coupon"),data:n,success:function(t){e(".woocommerce-error, .woocommerce-message").remove(),o.removeClass("processing").unblock(),t&&(e("form.woocommerce-checkout").before(t),e(document.body).trigger("removed_coupon_in_checkout",[n.coupon_code]),e(document.body).trigger("update_checkout",{update_shipping_method:!1}),e("form.checkout_coupon").find('input[name="coupon_code"]').val(""))},error:function(e){wc_checkout_params.debug_mode&&console.log(e.responseText)},dataType:"html"})}},d={init:function(){e(document.body).on("click","a.showlogin",this.show_login_form)},show_login_form:function(){return e("form.login, form.woocommerce-form--login").slideToggle(),!1}},u={init:function(){e(document.body).on("click","a.woocommerce-terms-and-conditions-link",this.toggle_terms)},toggle_terms:function(){if(e(".woocommerce-terms-and-conditions").length)return e(".woocommerce-terms-and-conditions").slideToggle(function(){var t=e(".woocommerce-terms-and-conditions-link");e(".woocommerce-terms-and-conditions").is(":visible")?(t.addClass("woocommerce-terms-and-conditions-link--open"),t.removeClass("woocommerce-terms-and-conditions-link--closed")):(t.removeClass("woocommerce-terms-and-conditions-link--open"),t.addClass("woocommerce-terms-and-conditions-link--closed"))}),!1}};if(r.init(),p.init(),d.init(),u.init(),payplus_script_checkout.hostedFieldsIsMain){var l=function(){e("li.payment_method_payplus-payment-gateway").attr("style","display: none !important;")};function m(){var t=e("input#payment_method_payplus-payment-gateway-hostedfields");t.length&&(t.is(":checked")||t.prop("checked",!0).trigger("change"),e(".payment_box.payment_method_payplus-payment-gateway-hostedfields").show().css("display","block"))}l(),e(document.body).on("updated_checkout",function(){l(),m()}),setTimeout(function(){l(),m()},100)}if(e(document.body).on("change",'input[name="payment_method"]',function(){var t=e('input[name="payment_method"]:checked').val();console.log("Payment method changed to:",t),"payplus-payment-gateway-hostedfields"===t&&e(".payment_box.payment_method_payplus-payment-gateway-hostedfields").show()}),e(document.body).on("click","#place_order",function(t){var o=e('input[name="wc-payplus-payment-gateway-payment-token"]:checked').val(),a=e("input#payment_method_payplus-payment-gateway-hostedfields"),n=e("input#payment_method_payplus-payment-gateway");if(a.is(":checked")&&o&&"new"!==o){if(console.log("INTERCEPTING: Forcing main gateway for token payment"),0===n.length)return console.error("Main gateway not found! Cannot process token payment."),alert("Error: Payment method not available for saved cards. Please contact support."),t.preventDefault(),!1;n.prop("checked",!0),a.prop("checked",!1)}var c=e('input[name="payment_method"]:checked').val(),i=e("body").attr("data-payplus-using-token");console.log("=== PLACE ORDER CLICKED ==="),console.log("Selected payment method:",c),console.log("Selected token:",o),console.log("Using token flag:",i),console.log("===========================")}),e(document.body).on("change",'input[name="wc-payplus-payment-gateway-payment-token"]',function(){var t=e(this).val(),o=e("input#payment_method_payplus-payment-gateway-hostedfields"),a=e(".payment_method_payplus-payment-gateway"),n=e("input#payment_method_payplus-payment-gateway");if(console.log("Token selection changed to:",t),console.log("Hosted fields checked:",o.is(":checked")),o.is(":checked"))if("new"!==t){if(0===a.length){e(".payment_method_payplus-payment-gateway-hostedfields").before('<li class="wc_payment_method payment_method_payplus-payment-gateway" style="display:none !important;"><input id="payment_method_payplus-payment-gateway" type="radio" class="input-radio" name="payment_method" value="payplus-payment-gateway" /><label for="payment_method_payplus-payment-gateway">PayPlus</label><div class="payment_box payment_method_payplus-payment-gateway"></div></li>'),n=e("input#payment_method_payplus-payment-gateway"),console.log("Main gateway added dynamically")}else a.css("display","none"),console.log("Main gateway already exists, hiding it");n.prop("checked",!0),e("body").attr("data-payplus-using-token","yes"),console.log("Switched to main gateway for token processing")}else o.prop("checked",!0),e("body").attr("data-payplus-using-token","no"),console.log("Using hosted fields for new payment method")}),e(document.body).on("click touchstart",".pp_iframe_h, .pp_iframe_h *",function(t){e("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")&&(e('input[name="wc-payplus-payment-gateway-payment-token"]:checked').prop("checked",!1),e("input#wc-payplus-payment-gateway-payment-token-new").prop("checked",!0).trigger("change"))}),payplus_script_checkout.hostedFieldsIsMain)setInterval(function(){var t=e(document.activeElement);if(t.is("iframe")&&t.closest(".pp_iframe_h").length&&e("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")){var o=e('input[name="wc-payplus-payment-gateway-payment-token"]:checked');o.length&&"new"!==o.val()&&(o.prop("checked",!1),e("input#wc-payplus-payment-gateway-payment-token-new").prop("checked",!0).trigger("change"),console.log("PayPlus: Detected iframe interaction, switched to new payment method"))}},300);function h(t){e("#pp_iframe").length&&(e("#pp_iframe").is(":visible")||!0===t)&&e("#pp_iframe").fadeOut(()=>{e(".payplus-option-description-area").show(),e("#place_order").prop("disabled",!1)})}e(document.body).on("click touchstart",".pp_iframe_h",function(t){var o=e(this).closest("li.wc_payment_method");if(o.length){var a=o.find('input[name="payment_method"]');a.length&&!a.is(":checked")&&a.prop("checked",!0).trigger("click")}}),e(e(window).on("popstate",()=>{h(!1)}));let _=!1;function y(){if(_)console.log("Apple script already loaded");else{const e=document.createElement("script");e.src=payplus_script_checkout.payplus_import_applepay_script,document.body.append(e),_=!0}}function f(e,t,a){let n=document.createElement("iframe");return n.id="pp_iframe",n.name="payplus-iframe",n.src=e,o?(n.height="100%",n.maxHeight="100vh"):n.height=a,n.width=t,n.setAttribute("style","border:0px"),n.setAttribute("allowpaymentrequest","allowpaymentrequest"),n}});1 jQuery(function(e){if("undefined"==typeof wc_checkout_params)return!1;let t=payplus_script_checkout.hostedFieldsIsMain,o=payplus_script_checkout.iframeAutoHeight,a="payment_method_payplus-payment-gateway-hostedfields";var n=jQuery("body > div.container.hostedFields");let i=!0;e.blockUI.defaults.overlayCSS.cursor="default";let c=Object.keys(payplus_script_checkout.hasSavedTokens);function s(){if(!(jQuery(".pp_iframe").length>0||jQuery(".pp_iframe_h").length>0||jQuery("#pp_iframe").length>0)){const e=jQuery(".payment_method_payplus-payment-gateway-hostedfields");if(e.length>0){e.hide(),jQuery(".payment_box.payment_method_payplus-payment-gateway-hostedfields").hide();const t=jQuery("input#payment_method_payplus-payment-gateway-hostedfields");t.is(":checked")&&jQuery("input#payment_method_payplus-payment-gateway").prop("checked",!0).trigger("change"),t.prop("disabled",!0)}}}s(),setTimeout(s,100),setTimeout(s,500),jQuery(document.body).on("updated_checkout",function(){s()}),window.addEventListener("message",function(e){if(e.data&&"payplus_redirect"===e.data.type&&e.data.url)try{new URL(e.data.url,window.location.origin).origin===window.location.origin&&(window.location.href=e.data.url)}catch(e){}});var r={updateTimer:!1,dirtyInput:!1,selectedPaymentMethod:!1,xhr:!1,$order_review:e("#order_review"),$checkout_form:e("form.checkout"),init:function(){e(document.body).on("update_checkout",this.update_checkout),e(document.body).on("init_checkout",this.init_checkout),this.$checkout_form.on("click",'input[name="payment_method"]',this.payment_method_selected),e(document.body).hasClass("woocommerce-order-pay")&&(this.$order_review.on("click",'input[name="payment_method"]',this.payment_method_selected),this.$order_review.on("submit",this.submitOrder),this.$order_review.attr("novalidate","novalidate")),this.$checkout_form.attr("novalidate","novalidate"),this.$checkout_form.on("submit",this.submit),this.$checkout_form.on("input validate change",".input-text, select, input:checkbox",this.validate_field),this.$checkout_form.on("update",this.trigger_update_checkout),this.$checkout_form.on("change",'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address input, .update_totals_on_change select, .update_totals_on_change input[type="radio"], .update_totals_on_change input[type="checkbox"]',this.trigger_update_checkout),this.$checkout_form.on("change",".address-field select",this.input_changed),this.$checkout_form.on("change",".address-field input.input-text, .update_totals_on_change input.input-text",this.maybe_input_changed),this.$checkout_form.on("keydown",".address-field input.input-text, .update_totals_on_change input.input-text",this.queue_update_checkout),this.$checkout_form.on("change","#ship-to-different-address input",this.ship_to_different_address),this.$checkout_form.find("#ship-to-different-address input").trigger("change"),this.init_payment_methods(),"1"===wc_checkout_params.is_checkout&&e(document.body).trigger("init_checkout"),"yes"===wc_checkout_params.option_guest_checkout&&e("input#createaccount").on("change",this.toggle_create_account).trigger("change")},init_payment_methods:function(){var t=e(".woocommerce-checkout").find('input[name="payment_method"]');1===t.length&&t.eq(0).hide(),r.selectedPaymentMethod&&e("#"+r.selectedPaymentMethod).prop("checked",!0),0===t.filter(":checked").length&&t.eq(0).prop("checked",!0);var o=t.filter(":checked").eq(0).prop("id");t.length>1&&e('div.payment_box:not(".'+o+'")').filter(":visible").slideUp(0),t.filter(":checked").eq(0).trigger("click")},get_payment_method:function(){return r.$checkout_form.find('input[name="payment_method"]:checked').val()},payment_method_selected:function(t){if(h(!0),t.stopPropagation(),e(".payment_methods input.input-radio").length>1){var o=e("div.payment_box."+e(this).attr("ID")),a=e(this).is(":checked");a&&!o.is(":visible")&&(e("div.payment_box").filter(":visible").slideUp(230),a&&o.slideDown(230))}e(this).data("order_button_text")?e("#place_order").text(e(this).data("order_button_text")):e("#place_order").text(e("#place_order").data("value"));var n=e('.woocommerce-checkout input[name="payment_method"]:checked').attr("id");n!==r.selectedPaymentMethod&&e(document.body).trigger("payment_method_selected"),r.selectedPaymentMethod=n},toggle_create_account:function(){e("div.create-account").hide(),e(this).is(":checked")&&(e("#account_password").val("").trigger("change"),e("div.create-account").slideDown())},init_checkout:function(){e(document.body).trigger("update_checkout")},maybe_input_changed:function(e){r.dirtyInput&&r.input_changed(e)},input_changed:function(e){r.dirtyInput=e.target,r.maybe_update_checkout()},queue_update_checkout:function(e){if(9===(e.keyCode||e.which||0))return!0;r.dirtyInput=this,r.reset_update_checkout_timer(),r.updateTimer=setTimeout(r.maybe_update_checkout,"1000")},trigger_update_checkout:function(){r.reset_update_checkout_timer(),r.dirtyInput=!1,e(document.body).trigger("update_checkout")},maybe_update_checkout:function(){var t=!0;if(e(r.dirtyInput).length){var o=e(r.dirtyInput).closest("div").find(".address-field.validate-required");o.length&&o.each(function(){""===e(this).find("input.input-text").val()&&(t=!1)})}t&&r.trigger_update_checkout()},ship_to_different_address:function(){e("div.shipping_address").hide(),e(this).is(":checked")&&e("div.shipping_address").slideDown()},reset_update_checkout_timer:function(){clearTimeout(r.updateTimer)},is_valid_json:function(e){try{var t=JSON.parse(e);return t&&"object"==typeof t}catch(e){return!1}},validate_field:function(t){var o=e(this),a=o.closest(".form-row"),n=!0,i=a.is(".validate-required"),c=a.is(".validate-email"),s=a.is(".validate-phone"),r="",p=t.type;"input"===p&&a.removeClass("woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-invalid-phone woocommerce-validated"),"validate"!==p&&"change"!==p||(i&&("checkbox"!==o.attr("type")||o.is(":checked")?""===o.val()&&(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"),n=!1):(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"),n=!1)),c&&o.val()&&((r=new RegExp(/^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i)).test(o.val())||(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-email woocommerce-invalid-phone"),n=!1)),s&&(r=new RegExp(/[\s\#0-9_\-\+\/\(\)\.]/g),0<o.val().replace(r,"").length&&(a.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-phone"),n=!1)),n&&a.removeClass("woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-invalid-phone").addClass("woocommerce-validated"))},update_checkout:function(e,t){r.reset_update_checkout_timer(),r.updateTimer=setTimeout(r.update_checkout_action,"5",t)},update_checkout_action:function(o){if(r.xhr&&r.xhr.abort(),0!==e("form.checkout").length){o=void 0!==o?o:{update_shipping_method:!0};var s=e("#billing_country").val(),p=e("#billing_state").val(),d=e(":input#billing_postcode").val(),u=e("#billing_city").val(),m=e(":input#billing_address_1").val(),l=e(":input#billing_address_2").val(),h=s,_=p,y=d,f=u,g=m,k=l,v=e(r.$checkout_form).find(".address-field.validate-required:visible"),w=!0;v.length&&v.each(function(){""===e(this).find(":input").val()&&(w=!1)}),e("#ship-to-different-address").find("input").is(":checked")&&(h=e("#shipping_country").val(),_=e("#shipping_state").val(),y=e(":input#shipping_postcode").val(),f=e("#shipping_city").val(),g=e(":input#shipping_address_1").val(),k=e(":input#shipping_address_2").val());var b={security:wc_checkout_params.update_order_review_nonce,payment_method:r.get_payment_method(),country:s,state:p,postcode:d,city:u,address:m,address_2:l,s_country:h,s_state:_,s_postcode:y,s_city:f,s_address:g,s_address_2:k,has_full_address:w,post_data:e("form.checkout").serialize()};if(!1!==o.update_shipping_method){var F={};e('select.shipping_method, input[name^="shipping_method"][type="radio"]:checked, input[name^="shipping_method"][type="hidden"]').each(function(){F[e(this).data("index")]=e(this).val()}),b.shipping_method=F}e(".woocommerce-checkout-payment, .woocommerce-checkout-review-order-table").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),r.xhr=e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","update_order_review"),data:b,success:function(o){if(o&&!0===o.reload)return void window.location.reload();e(".woocommerce-NoticeGroup-updateOrderReview").remove();var s=e("#terms").prop("checked"),p={};if(e(".payment_box :input").each(function(){var t=e(this).attr("id");t&&(-1!==e.inArray(e(this).attr("type"),["checkbox","radio"])?p[t]=e(this).prop("checked"):p[t]=e(this).val())}),payplus_script_checkout.isHostedFields&&0===c.length&&payplus_script_checkout.hidePPGateway){const e=function(e,t){const o=document.createElement("div");o.innerHTML=e;o.querySelectorAll(`.${t}`).forEach(e=>{e.remove()});return o.innerHTML}(o.fragments[".woocommerce-checkout-payment"],"wc_payment_method.payment_method_payplus-payment-gateway");o.fragments[".woocommerce-checkout-payment"]=e}e(".hostedFields").prop("outerHTML");o&&o.fragments&&(e.each(o.fragments,function(t,o){if(!r.fragments||r.fragments[t]!==o){e(t).replaceWith(o),payplus_script_checkout.isSubscriptionOrder&&e(".wc_payment_methods.payment_methods.methods .wc_payment_method").each(function(){e(this).attr("class").split(/\s+/).forEach(function(t){payplus_script_checkout.isLoggedIn?t.startsWith("payment_method_payplus-payment-gateway-")&&"payment_method_payplus-payment-gateway-hostedfields"!==t&&e(this).remove():t.startsWith("payment_method_payplus-payment-gateway-")&&e(this).remove()}.bind(this))}),document.querySelector("#payplus-checkout-image-div")||function(){if(void 0!==payplus_script_checkout?.customIcons[0]&&payplus_script_checkout?.customIcons[0]?.length>0){var t=e("<div></div>",{class:"payplus-checkout-image-container",id:"payplus-checkout-image-div",style:"display: flex;flex-wrap: wrap;justify-content: center;"});e.each(payplus_script_checkout.customIcons,function(o,a){var n=e("<img>",{src:a,class:"payplus-checkout-image",alt:"Image "+(o+1),style:"max-width: 100%; max-height:35px;object-fit: contain;"});t.append(n)}),e("div.payment_method_payplus-payment-gateway").prepend(t)}}();!function(){const e=document.querySelector("#payment_method_payplus-payment-gateway-multipass");if(e&&Object.keys(payplus_script_checkout.multiPassIcons).length>0){const n=payplus_script_checkout.multiPassIcons;function t(e){let t=document.querySelectorAll("img");for(let o of t)if(o.src.includes(e))return o;return null}function o(e,t){e&&t&&(e.style.height="32px",e.style.width="32px",e.style.transition="opacity 0.5s",e.style.opacity=0,setTimeout(()=>{e.src=t,e.style.opacity=1},500))}if(e){let i=t("multipassLogo.png");if(i){i.src;let c=0;const s=Object.keys(n).map(e=>n[e]);function a(){const e=s[c];o(i,e),c=(c+1)%s.length,Object.keys(payplus_script_checkout.multiPassIcons).length>1&&setTimeout(a,2e3)}a()}}}}()}e(t).unblock(),"undefined"!=typeof newPpShippingMethods&&createNewShippingMethods()}),payplus_script_checkout.isHostedFields&&h(a,t),r.fragments=o.fragments,"pp_iframe_h"===n.parent().attr("class")&&function(){if(payplus_script_checkout.isHostedFields){if(!(jQuery(".pp_iframe").length>0||jQuery(".pp_iframe_h").length>0))return jQuery(".payment_method_payplus-payment-gateway-hostedfields").hide(),void(jQuery("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")&&jQuery("input#payment_method_payplus-payment-gateway").prop("checked",!0).trigger("change"));if(i){i=!1;var o=e('<p class="hf-save form-row"><label for="save_token_checkbox"><input type="checkbox" name="wc-save-token" id="save_token_checkbox" value="1" style="margin:0 10px 0 10px;"/> '+payplus_script_checkout.saveCreditCard+"</label></p>");payplus_script_checkout.isLoggedIn&&payplus_script_checkout.isSavingCerditCards&&n.append(o),t?setTimeout(function(){e("input#"+a).prop("checked",!0),e("div.container.hostedFields").show()},1e3):setTimeout(function(){e(".payment_method_payplus-payment-gateway").css("display","block"),e("input#"+a).removeAttr("checked"),e(".container.hostedFields").hide(),e(".payment_box.payment_method_payplus-payment-gateway-hostedfields").hide(),e("input#payment_method_payplus-payment-gateway").prop("checked",!0)},1e3)}e(document).on("change",'input[name="payment_method"]',function(){e("input#"+a).is(":checked")?e("div.container.hostedFields").show():e(".container.hostedFields").hide()})}}());let d=!1;if(d)return;d=!0;var u=e('input[name="shipping_method[0]"]:checked').closest("li").find("label").text();""===u&&(u=e('input[name="shipping_method[0]"]').closest("li").find("label").text());var m=u.match(/(\$|₪)\s*([0-9.,]+)|([0-9.,]+)\s*(\$|₪)/);let l=0;if(m){m[1]||m[4];l=m[2]||m[3]}function h(t,o){o&&(e(".woocommerce-SavedPaymentMethods-new").hide(),e(".woocommerce-SavedPaymentMethods-saveNew").hide()),setTimeout(function(){if(e("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")){e(".container.hostedFields").show();const t=document.querySelector(".pp_iframe_h");t&&(t.style.display="block")}},2e3);var a=jQuery("#"+t),i=jQuery(".pp_iframe_h"),c=jQuery(".wc_payment_method."+t);let s=n.find(".hf-main").first();a.length&&i.length&&n.length&&(payplus_script_checkout.hostedFieldsWidth&&s.attr("style",function(e,t){return"width: "+payplus_script_checkout.hostedFieldsWidth+"% !important;"+(t?" "+t:"")}),i.append(n),c.append(i))}if(payplus_script_checkout.isHostedFields&&e(document.body).on("updated_checkout",function(){h(a,t)}),s&&e("#terms").prop("checked",!0),e.isEmptyObject(p)||e(".payment_box :input").each(function(){var t=e(this).attr("id");t&&(-1!==e.inArray(e(this).attr("type"),["checkbox","radio"])?e(this).prop("checked",p[t]).trigger("change"):(-1!==e.inArray(e(this).attr("type"),["select"])||null!==e(this).val()&&0===e(this).val().length)&&e(this).val(p[t]).trigger("change"))}),o&&"failure"===o.result){var _=e("form.checkout");e(".woocommerce-error, .woocommerce-message").remove(),o.messages?_.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-updateOrderReview">'+o.messages+"</div>"):_.prepend(o),_.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),r.scroll_to_notices()}r.init_payment_methods(),e(document.body).trigger("updated_checkout",[o])}})}},handleUnloadEvent:function(e){if(-1===navigator.userAgent.indexOf("MSIE")&&!document.documentMode)return!0;e.preventDefault()},attachUnloadEventsOnSubmit:function(){e(window).on("beforeunload",this.handleUnloadEvent)},detachUnloadEventsOnSubmit:function(){e(window).off("beforeunload",this.handleUnloadEvent)},blockOnSubmit:function(t){1!==t.data("blockUI.isBlocked")&&(t.block({message:null,overlayCSS:{top:0,height:"100%",background:"#fff",opacity:.6}}),e(".blockUI.blockOverlay").css("position","fixed"))},submitOrder:function(){r.blockOnSubmit(e(this))},submit:function(){r.reset_update_checkout_timer();var t=e(this);return t.is(".processing")||!1!==t.triggerHandler("checkout_place_order")&&!1!==t.triggerHandler("checkout_place_order_"+r.get_payment_method())&&(t.addClass("processing"),r.blockOnSubmit(t),r.attachUnloadEventsOnSubmit(),e.ajaxSetup({dataFilter:function(e,t){if("json"!==t)return e;if(r.is_valid_json(e))return e;var o=e.match(/{"result.*}/);return null===o||r.is_valid_json(o[0])&&(e=o[0]),e}}),e.ajax({type:"POST",url:wc_checkout_params.checkout_url,data:t.serialize(),dataType:"json",success:function(o){if("hostedFields"===o.method)jQuery.ajax({type:"post",dataType:"json",url:payplus_script_checkout.ajax_url,data:{action:"get-hosted-payload",_ajax_nonce:payplus_script_checkout.frontNonce},success:function(e){const t=JSON.parse(e.data.hostedPayload);JSON.parse(e.data.hostedResponse);t.more_info&&!isNaN(t.more_info)&&"number"==typeof t.more_info?(overlay(),jQuery(".blocks-payplus_loader_hosted").fadeIn(),r.$checkout_form.removeClass("processing").unblock(),hf.SubmitPayment()):(window.onbeforeunload=null,window.removeEventListener("beforeunload",r.detachUnloadEventsOnSubmit()),alert("The payment page has expired, refresh the page to continue"),location.reload())}});else{if(r.detachUnloadEventsOnSubmit(),o.payplus_iframe&&"success"===o.result)return r.$checkout_form.removeClass("processing").unblock(),"samePageIframe"==o.viewMode?function(t){e(".alertify").remove();const o=new URL(window.location.href);o.searchParams.set("payplus-iframe","1"),window.history.pushState({},"",o);const a=document.querySelector(".pp_iframe"),n=a.getAttribute("data-height");a.innerHTML="",a.append(f(t,"100%",n)),e("#closeFrame").on("click",function(e){e.preventDefault(),a.style.display="none"}),e("#place_order").prop("disabled",!0),payplus_script_checkout.payplus_mobile&&e("html, body").animate({scrollTop:e(".place-order").offset().top});y()}(o.payplus_iframe.data.payment_page_link):"popupIframe"==o.viewMode&&function(e,t){let o=window.innerWidth;o<568&&(t="100%");alertify.popupIframePaymentPage||alertify.dialog("popupIframePaymentPage",function(){return{main:function(e){this.message=f(e,"100%",t),y()},setup:function(){return{options:{autoReset:!1,overflow:!1,maximizable:!1,movable:!1,frameless:!0,transition:"fade"},focus:{element:0}}},prepare:function(){this.setContent(this.message)},hooks:{onshow:function(){this.elements.dialog.style.maxWidth="100%",this.elements.dialog.style.width=o>768?payplus_script_checkout.iframeWidth||"40%":"98%",this.elements.dialog.style.height=o>568?"82%":"100%",this.elements.content.style.top="25px"}}}});alertify.popupIframePaymentPage(e)}(o.payplus_iframe.data.payment_page_link,700),!0;try{if("success"!==o.result||!1===t.triggerHandler("checkout_place_order_success",o))throw"failure"===o.result?"Result failure":"Invalid response";-1===o.redirect.indexOf("https://")||-1===o.redirect.indexOf("http://")?window.location=o.redirect:window.location=decodeURI(o.redirect)}catch(t){if(!0===o.reload)return void window.location.reload();!0===o.refresh&&e(document.body).trigger("update_checkout"),o.messages?r.submit_error(o.messages):r.submit_error('<div class="woocommerce-error">'+wc_checkout_params.i18n_checkout_error+"</div>")}}},error:function(e,t,o){r.detachUnloadEventsOnSubmit(),r.submit_error('<div class="woocommerce-error">'+o+"</div>")}})),!1},submit_error:function(t){e(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),r.$checkout_form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+t+"</div>"),r.$checkout_form.removeClass("processing").unblock(),r.$checkout_form.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),r.scroll_to_notices(),e(document.body).trigger("checkout_error",[t])},scroll_to_notices:function(){var t=e(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");t.length||(t=e(".form.checkout")),e.scroll_to_notices(t)}},p={init:function(){e(document.body).on("click","a.showcoupon",this.show_coupon_form),e(document.body).on("click",".woocommerce-remove-coupon",this.remove_coupon),e("form.checkout_coupon").hide().on("submit",this.submit)},show_coupon_form:function(){return e(".checkout_coupon").slideToggle(400,function(){e(".checkout_coupon").find(":input:eq(0)").trigger("focus")}),!1},submit:function(){var t=e(this);if(t.is(".processing"))return!1;t.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o={security:wc_checkout_params.apply_coupon_nonce,coupon_code:t.find('input[name="coupon_code"]').val()};return e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:o,success:function(a){e(".woocommerce-error, .woocommerce-message").remove(),t.removeClass("processing").unblock(),a&&(t.before(a),t.slideUp(),e(document.body).trigger("applied_coupon_in_checkout",[o.coupon_code]),e(document.body).trigger("update_checkout",{update_shipping_method:!1}))},dataType:"html"}),!1},remove_coupon:function(t){t.preventDefault();var o=e(this).parents(".woocommerce-checkout-review-order"),a=e(this).data("coupon");o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={security:wc_checkout_params.remove_coupon_nonce,coupon:a};e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_coupon"),data:n,success:function(t){e(".woocommerce-error, .woocommerce-message").remove(),o.removeClass("processing").unblock(),t&&(e("form.woocommerce-checkout").before(t),e(document.body).trigger("removed_coupon_in_checkout",[n.coupon_code]),e(document.body).trigger("update_checkout",{update_shipping_method:!1}),e("form.checkout_coupon").find('input[name="coupon_code"]').val(""))},error:function(){},dataType:"html"})}},d={init:function(){e(document.body).on("click","a.showlogin",this.show_login_form)},show_login_form:function(){return e("form.login, form.woocommerce-form--login").slideToggle(),!1}},u={init:function(){e(document.body).on("click","a.woocommerce-terms-and-conditions-link",this.toggle_terms)},toggle_terms:function(){if(e(".woocommerce-terms-and-conditions").length)return e(".woocommerce-terms-and-conditions").slideToggle(function(){var t=e(".woocommerce-terms-and-conditions-link");e(".woocommerce-terms-and-conditions").is(":visible")?(t.addClass("woocommerce-terms-and-conditions-link--open"),t.removeClass("woocommerce-terms-and-conditions-link--closed")):(t.removeClass("woocommerce-terms-and-conditions-link--open"),t.addClass("woocommerce-terms-and-conditions-link--closed"))}),!1}};if(r.init(),p.init(),d.init(),u.init(),payplus_script_checkout.hostedFieldsIsMain){var m=function(){e("li.payment_method_payplus-payment-gateway").attr("style","display: none !important;")};function l(){var t=e("input#payment_method_payplus-payment-gateway-hostedfields");t.length&&(t.is(":checked")||t.prop("checked",!0).trigger("change"),e(".payment_box.payment_method_payplus-payment-gateway-hostedfields").show().css("display","block"))}m(),e(document.body).on("updated_checkout",function(){m(),l()}),setTimeout(function(){m(),l()},100)}if(e(document.body).on("change",'input[name="payment_method"]',function(){"payplus-payment-gateway-hostedfields"===e('input[name="payment_method"]:checked').val()&&e(".payment_box.payment_method_payplus-payment-gateway-hostedfields").show()}),e(document.body).on("click","#place_order",function(t){var o=e('input[name="wc-payplus-payment-gateway-payment-token"]:checked').val(),a=e("input#payment_method_payplus-payment-gateway-hostedfields"),n=e("input#payment_method_payplus-payment-gateway");if(a.is(":checked")&&o&&"new"!==o){if(0===n.length)return alert("Error: Payment method not available for saved cards. Please contact support."),t.preventDefault(),!1;n.prop("checked",!0),a.prop("checked",!1)}}),e(document.body).on("change",'input[name="wc-payplus-payment-gateway-payment-token"]',function(){var t=e(this).val(),o=e("input#payment_method_payplus-payment-gateway-hostedfields"),a=e(".payment_method_payplus-payment-gateway"),n=e("input#payment_method_payplus-payment-gateway");if(o.is(":checked"))if("new"!==t){if(0===a.length){e(".payment_method_payplus-payment-gateway-hostedfields").before('<li class="wc_payment_method payment_method_payplus-payment-gateway" style="display:none !important;"><input id="payment_method_payplus-payment-gateway" type="radio" class="input-radio" name="payment_method" value="payplus-payment-gateway" /><label for="payment_method_payplus-payment-gateway">PayPlus</label><div class="payment_box payment_method_payplus-payment-gateway"></div></li>'),n=e("input#payment_method_payplus-payment-gateway")}else a.css("display","none");n.prop("checked",!0),e("body").attr("data-payplus-using-token","yes")}else o.prop("checked",!0),e("body").attr("data-payplus-using-token","no")}),e(document.body).on("click touchstart",".pp_iframe_h, .pp_iframe_h *",function(t){e("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")&&(e('input[name="wc-payplus-payment-gateway-payment-token"]:checked').prop("checked",!1),e("input#wc-payplus-payment-gateway-payment-token-new").prop("checked",!0).trigger("change"))}),payplus_script_checkout.hostedFieldsIsMain)setInterval(function(){var t=e(document.activeElement);if(t.is("iframe")&&t.closest(".pp_iframe_h").length&&e("input#payment_method_payplus-payment-gateway-hostedfields").is(":checked")){var o=e('input[name="wc-payplus-payment-gateway-payment-token"]:checked');o.length&&"new"!==o.val()&&(o.prop("checked",!1),e("input#wc-payplus-payment-gateway-payment-token-new").prop("checked",!0).trigger("change"))}},300);function h(t){e("#pp_iframe").length&&(e("#pp_iframe").is(":visible")||!0===t)&&e("#pp_iframe").fadeOut(()=>{e(".payplus-option-description-area").show(),e("#place_order").prop("disabled",!1)})}e(document.body).on("click touchstart",".pp_iframe_h",function(t){var o=e(this).closest("li.wc_payment_method");if(o.length){var a=o.find('input[name="payment_method"]');a.length&&!a.is(":checked")&&a.prop("checked",!0).trigger("click")}}),e(e(window).on("popstate",()=>{h(!1)}));let _=!1;function y(){if(_)console.log("Apple script already loaded");else{const e=document.createElement("script");e.src=payplus_script_checkout.payplus_import_applepay_script,document.body.append(e),_=!0}}function f(e,t,a){let n=document.createElement("iframe");return n.id="pp_iframe",n.name="payplus-iframe",n.src=e,o?(n.height="100%",n.maxHeight="100vh"):n.height=a,n.width=t,n.setAttribute("style","border:0px"),n.setAttribute("allowpaymentrequest","allowpaymentrequest"),n}}); -
payplus-payment-gateway/trunk/block/dist/js/woocommerce-blocks/blocks.js
r3457789 r3458643 100 100 } 101 101 } 102 103 // Firefox blocks cross-origin iframe from navigating top window. When PayPlus iframe sends 104 // postMessage with redirect URL (or thank-you page loads in iframe), parent performs the redirect. 105 window.addEventListener("message", function (e) { 106 if (!e.data || e.data.type !== "payplus_redirect" || !e.data.url) { 107 return; 108 } 109 try { 110 var u = new URL(e.data.url, window.location.origin); 111 if (u.origin === window.location.origin) { 112 window.location.href = e.data.url; 113 } 114 } catch (err) { 115 // ignore invalid URL 116 } 117 }); 102 118 103 119 (() => { -
payplus-payment-gateway/trunk/block/dist/js/woocommerce-blocks/blocks.min.js
r3457789 r3458643 1 let CHECKOUT_STORE_KEY=window.wc.wcBlocksData["CHECKOUT_STORE_KEY"],PAYMENT_STORE_KEY=window.wc.wcBlocksData["PAYMENT_STORE_KEY"],store=wp.data.select(CHECKOUT_STORE_KEY),payment=wp.data.select(PAYMENT_STORE_KEY),hasOrder=store.hasOrder(),isCheckout=!!document.querySelector('div[data-block-name="woocommerce/checkout"]');if(isCheckout||hasOrder){console.log("checkout page?",isCheckout),console.log("has order?",hasOrder);let e=store.getCustomerId(),t=store.getAdditionalFields(),a=store.getOrderId(),r=window.wc.wcSettings.getPaymentMethodData("payplus-payment-gateway");function addScriptApple(){var e;isMyScriptLoaded(r.importApplePayScript)&&((e=document.createElement("script")).src=r.importApplePayScript,document.body.append(e))}function isMyScriptLoaded(e){for(var t=document.getElementsByTagName("script"),a=t.length;a--;)if(t[a].src==e)return!1;return!0}let y=window.wc.wcSettings.getPaymentMethodData("payplus-payment-gateway").gateways,o=(y=r.isSubscriptionOrder?["payplus-payment-gateway"]:y,y=r.isSubscriptionOrder&&r.isLoggedIn?["payplus-payment-gateway","payplus-payment-gateway-hostedfields"]:y,[]),n=window.React;for(let e=0;e<r.customIcons?.length;e++)o[e]=(0,n.createElement)("img",{src:r.customIcons[e],style:{maxHeight:"35px",height:"45px"}});let m=(0,n.createElement)("div",{className:"payplus-icons",style:{display:"flex",flexWrap:"wrap",width:"100%",maxWidth:"100%",gap:"5px"}},o),u=!!r.customIcons[0]?.length,l=0<Object.keys(r.hasSavedTokens).length,p=r.hideMainPayPlusGateway,s=r.hostedFieldsIsMain;if(s){let e=window.wp.data["dispatch"],t=window.wc.wcBlocksData.PAYMENT_STORE_KEY,a="payplus-payment-gateway-hostedfields";try{e(t).__internalSetActivePaymentMethod(a)}catch(e){}}function startIframe(e,t,a){document.body.appendChild(t),t.appendChild(a);var o=payment.getActivePaymentMethod(),n=window.wc.wcSettings.getPaymentMethodData(o)[o+"-settings"],a=document.createElement("iframe"),l=(a.width="95%",a.height="100%",a.style.border="0",a.style.display="block",a.style.margin="auto",a.src=e,document.querySelectorAll(".pp_iframe"));let s=document.querySelector("#radio-control-wc-payment-method-options-"+o).nextElementSibling.querySelector(".pp_iframe");if(-1!==["samePageIframe","popupIframe"].indexOf(n.displayMode)){if("payplus-payment-gateway"!==o)for(let e=0;e<l.length;e++){var i=l[e].parentNode.parentNode;i&&i.id.includes(o)&&(s=l[e])}switch(n.displayMode=window.innerWidth<=768&&"samePageIframe"===n.displayMode?"popupIframe":n.displayMode,n.displayMode){case"samePageIframe":s.style.position="relative",s.style.height=n.iFrameHeight,t.style.display="none";break;case"popupIframe":s.style.width=window.innerWidth<=768?"98%":n.iFrameWidth||"40%",s.style.height=n.iFrameHeight,s.style.position="fixed",s.style.top="50%",s.style.left="50%",s.style.paddingBottom=window.innerWidth<=768?"20px":"10px",s.style.paddingTop=window.innerWidth<=768?"20px":"10px",s.style.backgroundColor="white",s.style.transform="translate(-50%, -50%)",s.style.zIndex=1e5,s.style.boxShadow="10px 10px 10px 10px grey",s.style.borderRadius="5px",document.body.style.overflow="hidden",document.getElementsByClassName("blocks-payplus_loader")[0].style.display="none"}s.style.display="block",s.style.border="none",s.style.overflow="scroll",s.style.msOverflowStyle="none",s.style.scrollbarWidth="none",s.firstElementChild.style.display="block",s.firstElementChild.style.cursor="pointer",s.firstElementChild.addEventListener("click",e=>{e.preventDefault(),s.style.display="none";e=window.location.href;new URLSearchParams(e);location.reload()}),s.appendChild(a),r.importApplePayScript&&addScriptApple()}}function multiPassIcons(e,a=null){null===a&&(a=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway-multipass"));var t=wcSettings.paymentMethodSortOrder.includes("payplus-payment-gateway-multipass");if(e&&t&&0<Object.keys(wcSettings.paymentMethodData["payplus-payment-gateway"].multiPassIcons).length){let t=wcSettings.paymentMethodData["payplus-payment-gateway"].multiPassIcons;if(a){let s=function(e){var t;for(t of document.querySelectorAll("img"))if(t.src.includes(e))return t;return null}("multipassLogo.png");if(s){s.src;let n=0,l=Object.keys(t).map(e=>t[e]);!function e(){var t,a,o=l[n];t=s,a=o,t&&a?(t.style.transition="opacity 0.5s",t.style.opacity=0,setTimeout(()=>{t.src=a,t.style.opacity=1},500)):console.log("Image or new source not found."),n=(n+1)%l.length,1<Object.keys(wcSettings.paymentMethodData["payplus-payment-gateway"].multiPassIcons).length&&setTimeout(e,2e3)}()}}}}(()=>{let a=window.React,t=window.wc.wcBlocksRegistry,o=window.wp.i18n,n=window.wc.wcSettings,l=window.wp.htmlEntities,s=y,i=e=>(0,l.decodeEntities)(e.description||""),r=e=>{var t=e.components["PaymentMethodLabel"];return(0,a.createElement)("div",{className:"payplus-method",style:{width:"100%"}},(0,a.createElement)(t,{text:e.text,icon:""!==e.icon?(0,a.createElement)("img",{style:{width:"64px",height:"32px",maxHeight:"100%",margin:"0px 10px",objectPosition:"center"},src:e.icon}):null}),(0,a.createElement)("div",{className:"pp_iframe"},(0,a.createElement)("button",{className:"closeFrame",id:"closeFrame",style:{position:"absolute",top:"0px",fontSize:"20px",right:"0px",border:"none",color:"black",backgroundColor:"transparent",display:"none"}},"x")),0<e.icon.search("PayPlusLogo.svg")&&u?m:null)};for(let e=0;e<s.length;e++){var p=s[e],d=(0,n.getPaymentMethodData)(p,{}),c=(0,o.__)("Pay with Debit or Credit Card","payplus-payment-gateway"),c=(0,l.decodeEntities)(d?.title||"")||c,c={name:p,label:(0,a.createElement)(r,{text:c,icon:d.icon}),content:(0,a.createElement)(i,{description:d.description}),edit:(0,a.createElement)(i,{description:d.description}),canMakePayment:()=>!0,ariaLabel:c,supports:{showSaveOption:"payplus-payment-gateway"===p&&d.showSaveOption,features:d.supports}};(0,t.registerPaymentMethod)(c)}})(),document.addEventListener("DOMContentLoaded",function(){let a=!0;window.wc.wcSettings;var i=document.createElement("div"),e=(i.class="blocks-payplus_loader",document.createElement("div")),t=(e.className="blocks-payplus_loader",document.createElement("div")),o=(t.className="blocks-loader",document.createElement("div")),n=(o.className="blocks-loader-background",document.createElement("div"));function l(){var e=document.querySelector(".wc-block-checkout__actions_row button");e&&!e.hasAttribute("data-payplus-listener")&&(e.setAttribute("data-payplus-listener","true"),e.addEventListener("click",function(){var l=payment.getActivePaymentMethod();if(l&&l.includes("payplus-payment-gateway")){var s=document.createElement("div"),i=(s.id="early-payplus-overlay",s.style.cssText=` 2 position: fixed; 3 top: 0; 4 left: 0; 5 width: 100%; 6 height: 100%; 7 background-color: rgba(0, 0, 0, 0.5); 8 z-index: 999999; 9 display: flex; 10 align-items: center; 11 justify-content: center; 12 `,document.createElement("div"));i.style.cssText=` 13 background: white; 14 padding: 30px 50px; 15 border-radius: 12px; 16 text-align: center; 17 color: #333; 18 box-shadow: 0 8px 32px rgba(0,0,0,0.3); 19 min-width: 300px; 20 `;let e=document.createElement("div"),t=(e.style.cssText=` 21 font-size: 18px; 22 font-weight: 500; 23 margin-bottom: 15px; 24 `,document.createElement("div")),a=(t.style.cssText=` 25 font-size: 24px; 26 color: #007cba; 27 `,i.appendChild(e),i.appendChild(t),s.appendChild(i),document.body.appendChild(s),0);let o=setInterval(()=>{a=a%3+1,t.textContent=".".repeat(a)},400),n=("payplus-payment-gateway-hostedfields"===l?e.textContent=window.payplus_i18n&&window.payplus_i18n.processing_payment?window.payplus_i18n.processing_payment:"Processing your payment now":(e.textContent=window.payplus_i18n&&window.payplus_i18n.generating_page?window.payplus_i18n.generating_page:"Generating payment page",i=1e3*Math.random()+4e3,setTimeout(()=>{e.textContent=window.payplus_i18n&&window.payplus_i18n.loading_page?window.payplus_i18n.loading_page:"Loading payment page"},i)),setInterval(()=>{var e;(store.isComplete()||store.hasError())&&(clearInterval(o),clearInterval(n),e=document.getElementById("early-payplus-overlay"))&&e.remove()},100));setTimeout(()=>{clearInterval(o),clearInterval(n);var e=document.getElementById("early-payplus-overlay");e&&e.remove()},15e3)}}))}n.className="blocks-loader-text",o.appendChild(n),t.appendChild(o),e.appendChild(t),i.appendChild(e),l();let s=setInterval(()=>{l()},1e3);setTimeout(()=>{clearInterval(s)},1e4),setTimeout(function(){console.log("observer started");let s=document.createElement("div");s.style.backgroundColor="rgba(0, 0, 0, 0.5)",s.id="overlay",s.style.position="fixed",s.style.height="100%",s.style.width="100%",s.style.top="0",s.style.zIndex="5",setTimeout(()=>{var e=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway-multipass");a&&e&&(multiPassIcons(a,e),a=!1)},3e3),payPlusCC=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway");var e=new MutationObserver((e,a)=>{var t=payment.getActivePaymentMethod();if(0===t.search("payplus-payment-gateway-hostedfields")){var o=document.getElementsByClassName("pp_iframe_h")[0];if(o&&(o.style.display="flex",!o.querySelector(".payplus-hosted-place-order"))){let t=document.querySelector(".wc-block-checkout__actions_row button");var o=o.querySelector("#ppLogo"),n=window.wc.wcSettings.getPaymentMethodData("payplus-payment-gateway-hostedfields"),n=n&&"yes"===n.show_hide_submit_button;t&&o&&n&&((n=document.createElement("button")).className="btn btn-primary payplus-hosted-place-order wp-element-button wc-block-components-button wp-element-button contained",n.type="button",n.textContent=t.textContent,n.style.cssText=` 28 margin-top: 15px; 29 margin-bottom: 15px; 30 margin-right: auto; 31 margin-left: auto; 32 width: 90%; 33 background-color: rgb(0, 0, 0); 34 color: white; 35 border: none; 36 border-radius: 10px; 37 padding: 12px 24px; 38 font-size: 16px; 39 font-weight: 600; 40 cursor: pointer; 41 `,n.addEventListener("click",function(e){e.preventDefault(),t.click()}),o.parentNode.insertBefore(n,o))}}else{n=document.getElementsByClassName("pp_iframe_h")[0];n&&(n.style.display="none")}if(p&&(o=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway")?.closest(".wc-block-components-radio-control-accordion-option"))&&(o.style.display="none"),store.hasError())try{var l=payment.getPaymentResult();if(null==l||""===l)throw new Error("Payment result is empty, null, or undefined.");console.log("Payment result:",l);let t=document.querySelectorAll(".pp_iframe")[0];t.style.width=window.innerWidth<=768?"95%":"55%",t.style.height="200px",t.style.position="fixed",t.style.backgroundColor="white",t.style.display="flex",t.style.alignItems="center",t.style.textAlign="center",t.style.justifyContent="center",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.zIndex=1e5,t.style.boxShadow="10px 10px 10px 10px grey",t.style.borderRadius="25px",t.innerHTML=void 0!==l.paymentDetails.errorMessage?l.paymentDetails.errorMessage+"<br>"+(window.payplus_i18n&&window.payplus_i18n.click_to_close?window.payplus_i18n.click_to_close:"Click this to close."):l.message+"<br>"+(window.payplus_i18n&&window.payplus_i18n.click_to_close?window.payplus_i18n.click_to_close:"Click this to close."),t.addEventListener("click",e=>{e.preventDefault(),t.style.display="none",location.reload()}),console.log(l.paymentDetails.errorMessage),void 0!==l.paymentDetails.errorMessage?alert(l.paymentDetails.errorMessage):alert(l.message),a.disconnect()}catch(e){console.error("An error occurred:",e.message)}store.isComplete()&&(a.disconnect(),0===t.search("payplus-payment-gateway-hostedfields")?(hf.SubmitPayment(),document.body.style.overflow="hidden",document.body.style.backgroundColor="white",document.body.style.opacity="0.7",document.querySelector(".blocks-payplus_loader_hosted").style.display="block",document.querySelectorAll('input[type="radio"], input').forEach(e=>{e.disabled=!0}),hf.Upon("pp_responseFromServer",e=>{e.detail.errors&&location.reload()})):0===t.search("payplus-payment-gateway")&&0!==t.search("payplus-payment-gateway-pos-emv")&&(n=window.wc.wcSettings.getPaymentMethodData(t)[t+"-settings"],o=-1!==["samePageIframe","popupIframe"].indexOf(n.displayMode),console.log("isIframe?",o),-1!==y.indexOf(payment.getActivePaymentMethod()))&&0===payment.getActiveSavedToken().length&&(console.log("isComplete: "+store.isComplete()),o&&(0<payment.getPaymentResult().paymentDetails.paymentPageLink?.length?(console.log("paymentPageLink",payment.getPaymentResult().paymentDetails.paymentPageLink),startIframe(payment.getPaymentResult().paymentDetails.paymentPageLink,s,i)):(alert(window.payplus_i18n&&window.payplus_i18n.payment_page_failed?window.payplus_i18n.payment_page_failed:"Error: the payment page failed to load."),location.reload())),a.disconnect()))}),t=document.body;e.observe(t,{childList:!0,subtree:!0})}(),1e3)});let i=(e=!1)=>{e?$overlay&&($overlay.remove(),jQuery("body").css({overflow:""}),$overlay=null):$overlay||($overlay=jQuery("<div></div>").css({position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255, 255, 255, 0.7)",zIndex:9999,cursor:"not-allowed"}).appendTo("body"),jQuery("body").css({overflow:"hidden"}),$overlay.on("click",function(e){e.stopPropagation(),e.preventDefault()}))}} 1 const{CHECKOUT_STORE_KEY:CHECKOUT_STORE_KEY}=window.wc.wcBlocksData,{PAYMENT_STORE_KEY:PAYMENT_STORE_KEY}=window.wc.wcBlocksData,store=wp.data.select(CHECKOUT_STORE_KEY),payment=wp.data.select(PAYMENT_STORE_KEY),hasOrder=store.hasOrder(),isCheckout=!!document.querySelector('div[data-block-name="woocommerce/checkout"]');if(isCheckout||hasOrder){console.log("checkout page?",isCheckout),console.log("has order?",hasOrder);store.getCustomerId(),store.getAdditionalFields(),store.getOrderId();const e=window.wc.wcSettings.getPaymentMethodData("payplus-payment-gateway");function addScriptApple(){if(isMyScriptLoaded(e.importApplePayScript)){const t=document.createElement("script");t.src=e.importApplePayScript,document.body.append(t)}}function isMyScriptLoaded(e){for(var t=document.getElementsByTagName("script"),n=t.length;n--;)if(t[n].src==e)return!1;return!0}let t=window.wc.wcSettings.getPaymentMethodData("payplus-payment-gateway").gateways;t=e.isSubscriptionOrder?["payplus-payment-gateway"]:t,t=e.isSubscriptionOrder&&e.isLoggedIn?["payplus-payment-gateway","payplus-payment-gateway-hostedfields"]:t;let n=[];const o=window.React;for(let i=0;i<e.customIcons?.length;i++)n[i]=(0,o.createElement)("img",{src:e.customIcons[i],style:{maxHeight:"35px",height:"45px"}});const a=(0,o.createElement)("div",{className:"payplus-icons",style:{display:"flex",flexWrap:"wrap",width:"100%",maxWidth:"100%",gap:"5px"}},n);let s=!!e.customIcons[0]?.length;Object.keys(e.hasSavedTokens).length;const l=e.hideMainPayPlusGateway;if(e.hostedFieldsIsMain){const{dispatch:r}=window.wp.data,c=window.wc.wcBlocksData.PAYMENT_STORE_KEY,p="payplus-payment-gateway-hostedfields";try{r(c).__internalSetActivePaymentMethod(p)}catch(d){}}function startIframe(t,n,o){document.body.appendChild(n),n.appendChild(o);const a=payment.getActivePaymentMethod(),s=window.wc.wcSettings.getPaymentMethodData(a)[a+"-settings"];var l=document.createElement("iframe");l.width="95%",l.height="100%",l.style.border="0",l.style.display="block",l.style.margin="auto",l.src=t;let i=document.querySelectorAll(".pp_iframe"),r=document.querySelector(`#radio-control-wc-payment-method-options-${a}`).nextElementSibling.querySelector(".pp_iframe");if(-1!==["samePageIframe","popupIframe"].indexOf(s.displayMode)){if("payplus-payment-gateway"!==a)for(let e=0;e<i.length;e++){const t=i[e].parentNode.parentNode;if(t){t.id.includes(a)&&(r=i[e])}}switch(s.displayMode=window.innerWidth<=768&&"samePageIframe"===s.displayMode?"popupIframe":s.displayMode,s.displayMode){case"samePageIframe":r.style.position="relative",r.style.height=s.iFrameHeight,n.style.display="none";break;case"popupIframe":r.style.width=window.innerWidth<=768?"98%":s.iFrameWidth||"40%",r.style.height=s.iFrameHeight,r.style.position="fixed",r.style.top="50%",r.style.left="50%",r.style.paddingBottom=window.innerWidth<=768?"20px":"10px",r.style.paddingTop=window.innerWidth<=768?"20px":"10px",r.style.backgroundColor="white",r.style.transform="translate(-50%, -50%)",r.style.zIndex=1e5,r.style.boxShadow="10px 10px 10px 10px grey",r.style.borderRadius="5px",document.body.style.overflow="hidden",document.getElementsByClassName("blocks-payplus_loader")[0].style.display="none"}r.style.display="block",r.style.border="none",r.style.overflow="scroll",r.style.msOverflowStyle="none",r.style.scrollbarWidth="none",r.firstElementChild.style.display="block",r.firstElementChild.style.cursor="pointer",r.firstElementChild.addEventListener("click",e=>{e.preventDefault(),r.style.display="none";var t=window.location.href;new URLSearchParams(t);location.reload()}),r.appendChild(l),e.importApplePayScript&&addScriptApple()}}function multiPassIcons(e,t=null){null===t&&(t=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway-multipass"));const n=wcSettings.paymentMethodSortOrder.includes("payplus-payment-gateway-multipass");if(e&&n&&Object.keys(wcSettings.paymentMethodData["payplus-payment-gateway"].multiPassIcons).length>0){const n=wcSettings.paymentMethodData["payplus-payment-gateway"].multiPassIcons;if(t){let t=function(e){let t=document.querySelectorAll("img");for(let n of t)if(n.src.includes(e))return n;return null}("multipassLogo.png");if(t){t.src;let o=0;const a=Object.keys(n).map(e=>n[e]);!function e(){const n=a[o];!function(e,t){e&&t?(e.style.transition="opacity 0.5s",e.style.opacity=0,setTimeout(()=>{e.src=t,e.style.opacity=1},500)):console.log("Image or new source not found.")}(t,n),o=(o+1)%a.length,Object.keys(wcSettings.paymentMethodData["payplus-payment-gateway"].multiPassIcons).length>1&&setTimeout(e,2e3)}(),e=!1}}}}window.addEventListener("message",function(e){if(e.data&&"payplus_redirect"===e.data.type&&e.data.url)try{new URL(e.data.url,window.location.origin).origin===window.location.origin&&(window.location.href=e.data.url)}catch(e){}}),(()=>{const e=window.React,n=window.wc.wcBlocksRegistry,o=window.wp.i18n,l=window.wc.wcSettings,i=window.wp.htmlEntities,r=t,c=e=>(0,i.decodeEntities)(e.description||""),p=t=>{const{PaymentMethodLabel:n}=t.components;return(0,e.createElement)("div",{className:"payplus-method",style:{width:"100%"}},(0,e.createElement)(n,{text:t.text,icon:""!==t.icon?(0,e.createElement)("img",{style:{width:"64px",height:"32px",maxHeight:"100%",margin:"0px 10px",objectPosition:"center"},src:t.icon}):null}),(0,e.createElement)("div",{className:"pp_iframe"},(0,e.createElement)("button",{className:"closeFrame",id:"closeFrame",style:{position:"absolute",top:"0px",fontSize:"20px",right:"0px",border:"none",color:"black",backgroundColor:"transparent",display:"none"}},"x")),t.icon.search("PayPlusLogo.svg")>0&&s?a:null)};(()=>{for(let t=0;t<r.length;t++){const a=r[t],s=(0,l.getPaymentMethodData)(a,{}),d=(0,o.__)("Pay with Debit or Credit Card","payplus-payment-gateway"),y=(0,i.decodeEntities)(s?.title||"")||d,m={name:a,label:(0,e.createElement)(p,{text:y,icon:s.icon}),content:(0,e.createElement)(c,{description:s.description}),edit:(0,e.createElement)(c,{description:s.description}),canMakePayment:()=>!0,ariaLabel:y,supports:{showSaveOption:"payplus-payment-gateway"===a&&s.showSaveOption,features:s.supports}};(0,n.registerPaymentMethod)(m)}})()})(),document.addEventListener("DOMContentLoaded",function(){let e=!0;window.wc.wcSettings;var n=document.createElement("div");n.class="blocks-payplus_loader";const o=document.createElement("div");o.className="blocks-payplus_loader";const a=document.createElement("div");a.className="blocks-loader";const s=document.createElement("div");s.className="blocks-loader-background";const i=document.createElement("div");function r(){const e=document.querySelector(".wc-block-checkout__actions_row button");e&&!e.hasAttribute("data-payplus-listener")&&(e.setAttribute("data-payplus-listener","true"),e.addEventListener("click",function(){const e=payment.getActivePaymentMethod();if(e&&e.includes("payplus-payment-gateway")){const t=document.createElement("div");t.id="early-payplus-overlay",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 999999;\n display: flex;\n align-items: center;\n justify-content: center;\n ";const n=document.createElement("div");n.style.cssText="\n background: white;\n padding: 30px 50px;\n border-radius: 12px;\n text-align: center;\n color: #333;\n box-shadow: 0 8px 32px rgba(0,0,0,0.3);\n min-width: 300px;\n ";const o=document.createElement("div");o.style.cssText="\n font-size: 18px;\n font-weight: 500;\n margin-bottom: 15px;\n ";const a=document.createElement("div");a.style.cssText="\n font-size: 24px;\n color: #007cba;\n ",n.appendChild(o),n.appendChild(a),t.appendChild(n),document.body.appendChild(t);let s=0;const l=setInterval(()=>{s=s%3+1,a.textContent=".".repeat(s)},400);if("payplus-payment-gateway-hostedfields"===e)o.textContent=window.payplus_i18n&&window.payplus_i18n.processing_payment?window.payplus_i18n.processing_payment:"Processing your payment now";else{o.textContent=window.payplus_i18n&&window.payplus_i18n.generating_page?window.payplus_i18n.generating_page:"Generating payment page";const e=1e3*Math.random()+4e3;setTimeout(()=>{o.textContent=window.payplus_i18n&&window.payplus_i18n.loading_page?window.payplus_i18n.loading_page:"Loading payment page"},e)}const i=setInterval(()=>{if(store.isComplete()||store.hasError()){clearInterval(l),clearInterval(i);const e=document.getElementById("early-payplus-overlay");e&&e.remove()}},100);setTimeout(()=>{clearInterval(l),clearInterval(i);const e=document.getElementById("early-payplus-overlay");e&&e.remove()},15e3)}}))}i.className="blocks-loader-text",s.appendChild(i),a.appendChild(s),o.appendChild(a),n.appendChild(o),r();const c=setInterval(()=>{r()},1e3);setTimeout(()=>{clearInterval(c)},1e4),setTimeout(function(){console.log("observer started");const o=document.createElement("div");o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.id="overlay",o.style.position="fixed",o.style.height="100%",o.style.width="100%",o.style.top="0",o.style.zIndex="5",setTimeout(()=>{let t=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway-multipass");e&&t&&(multiPassIcons(e,t),e=!1)},3e3),payPlusCC=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway");const a=new MutationObserver((e,a)=>{const s=payment.getActivePaymentMethod();if(0===s.search("payplus-payment-gateway-hostedfields")){const e=document.getElementsByClassName("pp_iframe_h")[0];if(e&&(e.style.display="flex",!e.querySelector(".payplus-hosted-place-order"))){const t=document.querySelector(".wc-block-checkout__actions_row button"),n=e.querySelector("#ppLogo"),o=window.wc.wcSettings.getPaymentMethodData("payplus-payment-gateway-hostedfields"),a=o&&"yes"===o.show_hide_submit_button;if(t&&n&&a){const e=document.createElement("button");e.className="btn btn-primary payplus-hosted-place-order wp-element-button wc-block-components-button wp-element-button contained",e.type="button",e.textContent=t.textContent,e.style.cssText="\n margin-top: 15px;\n margin-bottom: 15px;\n margin-right: auto;\n margin-left: auto;\n width: 90%;\n background-color: rgb(0, 0, 0);\n color: white;\n border: none;\n border-radius: 10px;\n padding: 12px 24px;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n ",e.addEventListener("click",function(e){e.preventDefault(),t.click()}),n.parentNode.insertBefore(e,n)}}}else{const e=document.getElementsByClassName("pp_iframe_h")[0];e&&(e.style.display="none")}if(l){const e=document.querySelector("#radio-control-wc-payment-method-options-payplus-payment-gateway")?.closest(".wc-block-components-radio-control-accordion-option");e&&(e.style.display="none")}if(store.hasError())try{let e=payment.getPaymentResult();if(null==e||""===e)throw new Error("Payment result is empty, null, or undefined.");console.log("Payment result:",e);let t=document.querySelectorAll(".pp_iframe")[0];t.style.width=window.innerWidth<=768?"95%":"55%",t.style.height="200px",t.style.position="fixed",t.style.backgroundColor="white",t.style.display="flex",t.style.alignItems="center",t.style.textAlign="center",t.style.justifyContent="center",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.zIndex=1e5,t.style.boxShadow="10px 10px 10px 10px grey",t.style.borderRadius="25px",t.innerHTML=void 0!==e.paymentDetails.errorMessage?e.paymentDetails.errorMessage+"<br>"+(window.payplus_i18n&&window.payplus_i18n.click_to_close?window.payplus_i18n.click_to_close:"Click this to close."):e.message+"<br>"+(window.payplus_i18n&&window.payplus_i18n.click_to_close?window.payplus_i18n.click_to_close:"Click this to close."),t.addEventListener("click",e=>{e.preventDefault(),t.style.display="none",location.reload()}),console.log(e.paymentDetails.errorMessage),void 0!==e.paymentDetails.errorMessage?alert(e.paymentDetails.errorMessage):alert(e.message),a.disconnect()}catch(e){console.error("An error occurred:",e.message)}if(store.isComplete()){if(a.disconnect(),0===s.search("payplus-payment-gateway-hostedfields")){hf.SubmitPayment(),document.body.style.overflow="hidden",document.body.style.backgroundColor="white",document.body.style.opacity="0.7",document.querySelector(".blocks-payplus_loader_hosted").style.display="block";return document.querySelectorAll('input[type="radio"], input').forEach(e=>{e.disabled=!0}),void hf.Upon("pp_responseFromServer",e=>{e.detail.errors&&location.reload()})}if(0===s.search("payplus-payment-gateway")&&0!==s.search("payplus-payment-gateway-pos-emv")){const e=window.wc.wcSettings.getPaymentMethodData(s)[s+"-settings"],l=-1!==["samePageIframe","popupIframe"].indexOf(e.displayMode);console.log("isIframe?",l),-1!==t.indexOf(payment.getActivePaymentMethod())&&0===payment.getActiveSavedToken().length&&(console.log("isComplete: "+store.isComplete()),l&&(payment.getPaymentResult().paymentDetails.paymentPageLink?.length>0?(console.log("paymentPageLink",payment.getPaymentResult().paymentDetails.paymentPageLink),startIframe(payment.getPaymentResult().paymentDetails.paymentPageLink,o,n)):(alert(window.payplus_i18n&&window.payplus_i18n.payment_page_failed?window.payplus_i18n.payment_page_failed:"Error: the payment page failed to load."),location.reload())),a.disconnect())}}}),s=document.body;a.observe(s,{childList:!0,subtree:!0})}(),1e3)})} -
payplus-payment-gateway/trunk/hashes.json
r3457789 r3458643 1 1 { 2 "\/payplus-payment-gateway.php": " 2b33627ae1383d352a3ec054fce3183a5c0c0ef5f710fd883831b82e20035e7e",2 "\/payplus-payment-gateway.php": "97682e5ada11884a16392eea22a293b676d0795e3ec7e46731ef65ef1d9065c8", 3 3 "\/index.php": "c491dec192c55a18cd5d9ec23375720d58d40455dc685e7e4093c1198cc76b89", 4 "\/CHANGELOG.md": " 6bd26152015bad1c1d4c54f267c45e0ad19774550ca682b86f55795e1fa6fa8b",4 "\/CHANGELOG.md": "a0c15108d927872ca36893ad4ae42951b66cd36c53c47fb6b488b3996385684f", 5 5 "\/includes\/blocks\/class-wc-payplus-blocks-support.php": "9c5cc68026f25f7c8e0980f32ae83553cc1b453b6d4321c4d1a7db6c08ffa39f", 6 6 "\/includes\/wc_payplus_express_checkout.php": "0e227cc783f67068b2f23fd4e1045ac6b2b2969c483a11e8661a3ea3fa8c3b7d", … … 27 27 "\/languages\/payplus-payment-gateway.pot": "8869bece7da90f4afeafadf4ca2dfcf350f753bbe0663db16a083f1e0de8035d", 28 28 "\/templates\/hostedFields.php": "640574751191114c65fc137aa7b4ad7011452ce43043be1bd3ec0c4f6db26676", 29 "\/readme.txt": " 708063da6d12d89349335b182cb67ec7350ab1835e560c13522cb7e1b55bceb0",29 "\/readme.txt": "c0ba91c2da78271d554b39a04067cca3e98b57cb668afb4d519f861ec13b320f", 30 30 "\/assets\/css\/alertify.min.css": "12e60b6d60e45a69e3dc0f442bb4005eb47fba5ceb42fc6435cd8b4867a3f69d", 31 31 "\/assets\/css\/admin.scss": "02157f910d6c8f917da018bac5fed1022046b427e2a5a9174fc5cc68182070c5", … … 120 120 "\/assets\/js\/front.js": "2fa318e8e55c74203429c466d46d407b99e01ec596eb307e1efb535e18001090", 121 121 "\/assets\/js\/payplus-hosted-fields\/dist\/payplus-hosted-fields.min.js": "d8dbf1919a7307776634a6690fbb182e3652d3d16c56cae3b71c9061e85b0a0f", 122 "\/assets\/js\/checkout.min.js": " 53aa6a9ec5bcfa54b3717a07ff1a9b5110d683de1e0bd13d4780aa1ababf94c6",122 "\/assets\/js\/checkout.min.js": "22515ca338f5d4710be593cac426f1d83b3241446e4e52749b6c5c79f2eba47c", 123 123 "\/assets\/js\/admin.min.js": "78eb38cc7b3e871a8cfc882ab0254c075480dc8a29403d8d0f6d907eb3933ebc", 124 124 "\/assets\/js\/admin.js": "2de8d3a1cba863a77f8efc6c12112c8d4f08d58423488c3d54c39d5adf081c10", 125 125 "\/assets\/js\/alertify.min.js": "cb1d39a1e5cacaff5d2ee78770996d3c0f75a6f2a46fa6a960ae729b20a9244f", 126 126 "\/assets\/js\/admin-payments.min.js": "d732afbb5180ca9b3df12313edf99f0b4ef403c04ca168e9a6ebed37f3cf4714", 127 "\/assets\/js\/checkout.js": " 3280360ede0a69b06530391b4ee308d7c1ea7bee267401cef79ab33ffa2a6e8d",127 "\/assets\/js\/checkout.js": "1a79dfeec37a934dbd4e5bdf5d28b7386b44d4bfcf4cfd90ce6ba87f7ce5c00d", 128 128 "\/block\/dist\/css\/woocommerce-blocks\/style.css": "5b51b0d574ac6e17118924b59c0d2bdabd115a9db88b28d514146804e4204326", 129 "\/block\/dist\/js\/woocommerce-blocks\/blocks.min.js": " e669953ad4db0edfe1d13364a92213a3a137a478419ab54f25486356ab94a733",130 "\/block\/dist\/js\/woocommerce-blocks\/blocks.js": " 87fce11131ea108499daeb2b48e40fd70e49a1f57bca042210d2176b6dbe704e",129 "\/block\/dist\/js\/woocommerce-blocks\/blocks.min.js": "24b6325e9ae95b11bbbd328ff774f8951555ba5cd9801e486f39264394c607af", 130 "\/block\/dist\/js\/woocommerce-blocks\/blocks.js": "9767583a8ac5f03ac80c8455cafa7156bffed637d21f29667c8d6620d777181f", 131 131 "\/block\/dist\/js\/woocommerce-blocks\/blocks.asset.php": "888e6a1635c15d8041b5bc620a9caf8ba13c6ca43ce638dccef694add8f5e13a" 132 132 } -
payplus-payment-gateway/trunk/payplus-payment-gateway.php
r3457789 r3458643 5 5 * Description: Accept credit/debit card payments or other methods such as bit, Apple Pay, Google Pay in one page. Create digitally signed invoices & much more. 6 6 * Plugin URI: https://www.payplus.co.il/wordpress 7 * Version: 8.0. 27 * Version: 8.0.3 8 8 * Tested up to: 6.9 9 9 * Requires Plugins: woocommerce … … 20 20 define('PAYPLUS_PLUGIN_URL_ASSETS_IMAGES', PAYPLUS_PLUGIN_URL . "assets/images/"); 21 21 define('PAYPLUS_PLUGIN_DIR', dirname(__FILE__)); 22 define('PAYPLUS_VERSION', '8.0. 2');23 define('PAYPLUS_VERSION_DB', 'payplus_8_0_ 2');22 define('PAYPLUS_VERSION', '8.0.3'); 23 define('PAYPLUS_VERSION_DB', 'payplus_8_0_3'); 24 24 define('PAYPLUS_TABLE_PROCESS', 'payplus_payment_process'); 25 25 class WC_PayPlus … … 99 99 add_action('woocommerce_checkout_order_processed', [$this, 'payplus_checkout_order_processed'], 25, 3); 100 100 add_action('woocommerce_thankyou', [$this, 'payplus_clear_session_on_order_received'], 10, 1); 101 101 add_action('wp_footer', [$this, 'payplus_thankyou_iframe_redirect_script'], 5); 102 102 103 103 //FILTER … … 285 285 WC()->session->__unset('page_order_awaiting_payment'); 286 286 } 287 } 288 289 /** 290 * When thank-you page is loaded inside the PayPlus payment iframe (e.g. Firefox blocks 291 * iframe from navigating top), tell the parent to redirect so the top window goes to thank-you. 292 */ 293 public function payplus_thankyou_iframe_redirect_script() 294 { 295 if (!function_exists('is_wc_endpoint_url') || !is_wc_endpoint_url('order-received')) { 296 return; 297 } 298 // Only output when we're on order-received; parent will redirect when it receives this message. 299 echo "<script>(function(){if(window.self!==window.top){window.top.postMessage({type:'payplus_redirect',url:window.location.href},'*');}})();</script>\n"; 287 300 } 288 301 -
payplus-payment-gateway/trunk/readme.txt
r3457789 r3458643 1 === PayPlus Payment Gateway ===1 === PayPlus Payment Gateway === 2 2 Contributors: payplus 3 3 Tags: Woocommerce Payment Gateway, Credit Cards, Charges and Refunds, Subscriptions, Tokenization … … 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 8.0. 27 Stable tag: 8.0.3 8 8 PlugIn URL: https://www.payplus.co.il/wordpress 9 9 License: GPLv2 or later … … 86 86 87 87 == Changelog == 88 89 == 8.0.3 - 11-02-2026 = 90 91 - Fix - Firefox: redirect to thank-you page from payment iframe (parent performs redirect when iframe cannot). 88 92 89 93 == 8.0.2 - 10-02-2026 =
Note: See TracChangeset
for help on using the changeset viewer.