diff --git a/Model/ApiFacade/TpayConfig/ConfigOpen.php b/Model/ApiFacade/TpayConfig/ConfigOpen.php index fce7a75..9191375 100755 --- a/Model/ApiFacade/TpayConfig/ConfigOpen.php +++ b/Model/ApiFacade/TpayConfig/ConfigOpen.php @@ -122,7 +122,9 @@ public function fetchJavaScripts() $script[] = 'tpaycom_magento2basic::js/string_routines.js'; $script[] = 'tpaycom_magento2basic::js/tpayCards.js'; $script[] = 'tpaycom_magento2basic::js/renderSavedCards.js'; + $script[] = 'tpaycom_magento2basic::js/tpayGeneric.js'; $scripts = ''; + foreach ($script as $key => $value) { $scripts .= $this->createScript($value); } diff --git a/view/base/web/js/tpayGeneric.js b/view/base/web/js/tpayGeneric.js new file mode 100644 index 0000000..2cd51e7 --- /dev/null +++ b/view/base/web/js/tpayGeneric.js @@ -0,0 +1,24 @@ +require(['jquery', 'mage/translate'], function ($, $t) { + const tos = $('.generic_accept_tos'); + const payButton = $('.tpaycom_magento2generic_submit'); + const methods = $('input[name^="payment"]') + + + methods.on('click', function () { + payButton.each(function () { + $(this).addClass('disabled') + }) + }); + + tos.on('change', function () { + payButton.each(function () { + $(this).toggleClass('disabled') + }) + }); + + $(document).ready(function () { + payButton.each(function () { + $(this).addClass('disabled') + }) + }); +}); diff --git a/view/frontend/web/template/payment/tpay-generic-onsite.html b/view/frontend/web/template/payment/tpay-generic-onsite.html index 95aa7b1..1e3d38a 100644 --- a/view/frontend/web/template/payment/tpay-generic-onsite.html +++ b/view/frontend/web/template/payment/tpay-generic-onsite.html @@ -16,7 +16,7 @@