Skip to content

Commit

Permalink
Merge pull request #34 from buckaroo-it/BP-3715-Add-support-fot-Hyv-C…
Browse files Browse the repository at this point in the history
…heckout-1.1.23

Bp 3715 add support fot hyv checkout 1.1.23
  • Loading branch information
vegimcarkaxhija authored Aug 23, 2024
2 parents 03f7c60 + aeb051f commit 7f6d9f6
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 44 deletions.
1 change: 0 additions & 1 deletion Block/Totals/Fee.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function getTitle(): string
} catch (\Throwable $th) {
return __('Fee');
}
return __('Fee');
}

/**
Expand Down
39 changes: 0 additions & 39 deletions Model/MethodMetaData.php

This file was deleted.

32 changes: 32 additions & 0 deletions Plugin/IconRenderer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Buckaroo\HyvaCheckout\Plugin;

use Hyva\Checkout\Model\MethodMetaData\IconRenderer as IconRendererHyva;
use Magento\Framework\View\Asset\Repository;

class IconRenderer
{
protected Repository $assetRepository;

public function __construct(
Repository $assetRepository
) {
$this->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 '<img style="height:30px" src="' . $logoLink . '">';
}

// Otherwise, proceed with the default behavior
return $proceed($icon);
}
}
7 changes: 4 additions & 3 deletions Plugin/MethodList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 4 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
<type name="Hyva\Checkout\ViewModel\Checkout\Payment\MethodList">
<plugin name="buckaroo-hyva-logo-subtext" type="Buckaroo\HyvaCheckout\Plugin\MethodList" />
</type>

<type name="Hyva\Checkout\Model\MethodMetaData\IconRenderer">
<plugin name="buckaroo_hyva_checkout_icon_renderer" type="Buckaroo\HyvaCheckout\Plugin\IconRenderer" />
</type>
</config>

0 comments on commit 7f6d9f6

Please sign in to comment.