From ecea229c22dcc18a5a1eb5c0b70292b35b757a16 Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Thu, 22 Aug 2024 13:56:19 +0200 Subject: [PATCH 1/4] remove logger from MethodMetaData __construct, add image for paybybank --- Model/MethodMetaData.php | 2 +- Plugin/MethodList.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Model/MethodMetaData.php b/Model/MethodMetaData.php index f4b8c6e..5583303 100644 --- a/Model/MethodMetaData.php +++ b/Model/MethodMetaData.php @@ -23,7 +23,7 @@ public function __construct( Repository $assetRepository, array $data = [] ) { - parent::__construct($iconRenderer, $subtitleRenderer, $logger, $method, $systemConfigPayment, $data); + parent::__construct($iconRenderer, $subtitleRenderer, $method, $systemConfigPayment, $data); $this->assetRepository = $assetRepository; } public function renderIcon(): string diff --git a/Plugin/MethodList.php b/Plugin/MethodList.php index 29992a6..89efd80 100644 --- a/Plugin/MethodList.php +++ b/Plugin/MethodList.php @@ -66,11 +66,12 @@ private function getSvgLogo(string $methodCode): string "emandate" => "emandate.png", "pospayment" => "pos.png", "transfer" => "svg/sepa-credittransfer.svg", - "voucher" => "svg/vouchers.svg" + "voucher" => "svg/vouchers.svg", + "paybybank" => "paybybank.gif", ]; $name = "svg/{$method}.svg"; - + if(isset($mappings[$method])) { $name = $mappings[$method]; } From 278b58c29e764c38e37aef538164220fd467ae7f Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Thu, 22 Aug 2024 16:25:12 +0200 Subject: [PATCH 2/4] remove MethodMetaData and replace with IconRenderer to show icons --- Model/MethodMetaData.php | 39 --------------------------------------- Plugin/IconRenderer.php | 32 ++++++++++++++++++++++++++++++++ Plugin/MethodList.php | 2 +- etc/di.xml | 4 ++++ 4 files changed, 37 insertions(+), 40 deletions(-) delete mode 100644 Model/MethodMetaData.php create mode 100644 Plugin/IconRenderer.php diff --git a/Model/MethodMetaData.php b/Model/MethodMetaData.php deleted file mode 100644 index 5583303..0000000 --- a/Model/MethodMetaData.php +++ /dev/null @@ -1,39 +0,0 @@ -assetRepository = $assetRepository; - } - public function renderIcon(): string - { - $icon = parent::getData(self::ICON); - - if (!is_array($icon)) { - return ''; - } - $logoLink = $this->assetRepository->getUrl($icon['svg']); - return ''; - } -} diff --git a/Plugin/IconRenderer.php b/Plugin/IconRenderer.php new file mode 100644 index 0000000..04a328d --- /dev/null +++ b/Plugin/IconRenderer.php @@ -0,0 +1,32 @@ +assetRepository = $assetRepository; + } + + public function aroundRender( + IconRendererHyva $subject, + callable $proceed, + array $icon + ): string { + // Check if this is a Buckaroo method and handle it + if (isset($icon['svg']) && strpos($icon['svg'], 'Buckaroo_') !== false) { + $logoLink = $this->assetRepository->getUrl($icon['svg']); + return ''; + } + + // Otherwise, proceed with the default behavior + return $proceed($icon); + } +} diff --git a/Plugin/MethodList.php b/Plugin/MethodList.php index 89efd80..eb5f1e9 100644 --- a/Plugin/MethodList.php +++ b/Plugin/MethodList.php @@ -8,7 +8,7 @@ use Magento\Payment\Model\MethodInterface as PaymentMethodInterface; use Buckaroo\Magento2\Model\ConfigProvider\Method\ConfigProviderInterface; use Hyva\Checkout\ViewModel\Checkout\Payment\MethodList as HyvaMethodList; -use Buckaroo\HyvaCheckout\Model\MethodMetaDataFactory; +use Hyva\Checkout\Model\MethodMetaDataFactory; class MethodList implements \Magento\Framework\View\Element\Block\ArgumentInterface { diff --git a/etc/di.xml b/etc/di.xml index cfb41fd..35ef475 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -4,4 +4,8 @@ + + + + From cbe863291f3adf203545dc6dffe5b2111405682c Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Thu, 22 Aug 2024 17:00:32 +0200 Subject: [PATCH 3/4] remove extra return --- Block/Totals/Fee.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Block/Totals/Fee.php b/Block/Totals/Fee.php index ecdabb0..06c612d 100644 --- a/Block/Totals/Fee.php +++ b/Block/Totals/Fee.php @@ -41,7 +41,6 @@ public function getTitle(): string } catch (\Throwable $th) { return __('Fee'); } - return __('Fee'); } /** From aeb051f5aa9362f5e018c9a1b67a82623f8e1eb3 Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Fri, 23 Aug 2024 11:06:56 +0200 Subject: [PATCH 4/4] update hyva version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6634f2e..9581614 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "docs": "https://support.buckaroo.nl" }, "homepage": "https://www.buckaroo.nl", - "version" : "v1.1.2", + "version" : "v1.1.3", "minimum-stability": "stable", "autoload": { "files": [