From 9c2d4550f0aa323930f1a78062d1a8a0c2712f4e Mon Sep 17 00:00:00 2001 From: kGablo Date: Wed, 24 Jan 2024 09:53:53 +0100 Subject: [PATCH] Card save fix --- Model/Tpay.php | 2 +- etc/adminhtml/system.xml | 6 ++++ .../payment/method-renderer/tpay-method.js | 29 ------------------- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/Model/Tpay.php b/Model/Tpay.php index 1741d93..0a34d10 100755 --- a/Model/Tpay.php +++ b/Model/Tpay.php @@ -374,7 +374,7 @@ public function getConfigData($field, $storeId = null) public function getCardSaveEnabled(): bool { - return false; + return (bool) $this->getConfigData('cardpayment_settings/card_save_enabled'); } public function getCheckoutCustomerId(): ?string diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index d0c6e3c..21a70fd 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -138,6 +138,12 @@ Find in Merchant’s panel: Credit cards payment -> API 1 + + + Only available for logged in users + Magento\Config\Model\Config\Source\Yesno + 1 + diff --git a/view/frontend/web/js/view/payment/method-renderer/tpay-method.js b/view/frontend/web/js/view/payment/method-renderer/tpay-method.js index cf86b37..098eda1 100644 --- a/view/frontend/web/js/view/payment/method-renderer/tpay-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/tpay-method.js @@ -53,29 +53,6 @@ define( return window.checkoutConfig.tpay.payment.addCSS; }, - cardFetchJavaScripts: function () { - return window.checkoutConfig.tpaycards.payment.fetchJavaScripts; - }, - cardGetRSAkey: function () { - return window.checkoutConfig.tpaycards.payment.getRSAkey; - }, - cardGetLogoUrl: function () { - return window.checkoutConfig.tpay.payment.tpayCardsLogoUrl; - }, - cardGetTpayLoadingGif: function () { - return window.checkoutConfig.tpaycards.payment.getTpayLoadingGif; - }, - cardAddCSS: function () { - return window.checkoutConfig.tpaycards.payment.addCSS; - }, - - cardShowSaveBox: function () { - if (window.checkoutConfig.tpaycards.payment.isCustomerLoggedIn - && window.checkoutConfig.tpaycards.payment.isSavingEnabled) { - $('#tpay-card-save-checkbox').css('display', 'block'); - } - }, - getData: function () { var savedId = 'new'; $('input[id^=cardN]').each(function () { @@ -89,12 +66,6 @@ define( paymentData['blik_code'] = $('#blik_code').val(); paymentData['accept_tos'] = $('input[name="accept_tos"]').is(':checked'); - paymentData['card_data'] = $('input[name="card_data"]').val(); - paymentData['card_save'] = $('input[name="card_save"]').is(":checked"); - paymentData['card_id'] = savedId; - paymentData['card_vendor'] = $('input[name="card_vendor"]').val(); - paymentData['short_code'] = $('input[name="card_short_code"]').val(); - return $.extend(true, parent, {'additional_data': paymentData}); },