From 9e7edb3d79e1449e909cbb681b60df0ebe92640c Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Tue, 19 Nov 2024 09:37:20 +0200 Subject: [PATCH 1/3] [SL-269] init --- views/js/front/hosted-templates/hosted_fields.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/views/js/front/hosted-templates/hosted_fields.js b/views/js/front/hosted-templates/hosted_fields.js index 2ee1e631..245806e1 100755 --- a/views/js/front/hosted-templates/hosted_fields.js +++ b/views/js/front/hosted-templates/hosted_fields.js @@ -31,6 +31,11 @@ $(document).ready(function () { event.preventDefault(); var selectedCardMethod = $(this).find("[name=saved_card_method]").val(); + + if (selectedCardMethod === undefined) { + event.target.submit(); + } + var selectedCard = $(this).find("[name=selectedCreditCard_" + selectedCardMethod + "]").val(); //NOTE: not saved card chosen, continuing with normal procedures. From 4c01ab752fbcd09c9bba30f0822860464279969e Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Tue, 19 Nov 2024 10:20:22 +0200 Subject: [PATCH 2/3] [SL-269] fix logic --- views/js/front/hosted-templates/hosted_fields.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/js/front/hosted-templates/hosted_fields.js b/views/js/front/hosted-templates/hosted_fields.js index 245806e1..8b63ea7e 100755 --- a/views/js/front/hosted-templates/hosted_fields.js +++ b/views/js/front/hosted-templates/hosted_fields.js @@ -30,12 +30,13 @@ $(document).ready(function () { $('body').on('submit', '[id^=pay-with-][id$=-form] form', function (event) { event.preventDefault(); - var selectedCardMethod = $(this).find("[name=saved_card_method]").val(); + var isSaferPayMethodSelected = $('[data-module-name*="saferpayofficial"]:checked').length > 0; - if (selectedCardMethod === undefined) { + if (!isSaferPayMethodSelected) { event.target.submit(); } + var selectedCardMethod = $(this).find("[name=saved_card_method]").val(); var selectedCard = $(this).find("[name=selectedCreditCard_" + selectedCardMethod + "]").val(); //NOTE: not saved card chosen, continuing with normal procedures. From d1567efa07477c391e3da3d9fe408b1ac1099bb8 Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Tue, 19 Nov 2024 10:29:31 +0200 Subject: [PATCH 3/3] [SL-269] fix --- views/js/front/hosted-templates/hosted_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/js/front/hosted-templates/hosted_fields.js b/views/js/front/hosted-templates/hosted_fields.js index 8b63ea7e..72ec9527 100755 --- a/views/js/front/hosted-templates/hosted_fields.js +++ b/views/js/front/hosted-templates/hosted_fields.js @@ -30,7 +30,7 @@ $(document).ready(function () { $('body').on('submit', '[id^=pay-with-][id$=-form] form', function (event) { event.preventDefault(); - var isSaferPayMethodSelected = $('[data-module-name*="saferpayofficial"]:checked').length > 0; + var isSaferPayMethodSelected = $('[data-module-name*="saferpayofficial"]:checked').length; if (!isSaferPayMethodSelected) { event.target.submit();