diff --git a/Block/Totals/Fee.php b/Block/Totals/Fee.php index d956592..574fbc2 100644 --- a/Block/Totals/Fee.php +++ b/Block/Totals/Fee.php @@ -12,18 +12,20 @@ class Fee extends \Magento\Framework\View\Element\Template { protected PaymentFee $feeHelper; - protected SessionCheckout $sessionCheckout; + protected SessionCheckout $sessionCheckout; public function __construct( - Context $context, - array $data, - PaymentFee $feeHelper, + Context $context, + array $data, + PaymentFee $feeHelper, SessionCheckout $sessionCheckout - ) { + ) + { parent::__construct($context, $data); $this->feeHelper = $feeHelper; $this->sessionCheckout = $sessionCheckout; } + /** * Get title based on payment method config * @@ -33,8 +35,8 @@ public function getTitle(): string { try { $payment = $this->sessionCheckout - ->getQuote() - ->getPayment(); + ->getQuote() + ->getPayment(); return $this->feeHelper->getBuckarooPaymentFeeLabel($payment->getMethod()); } catch (\Throwable $th) { return __('Fee'); @@ -50,11 +52,11 @@ public function getTitle(): string public function getTotal(): float { $totalData = $this->getSegment(); + $extensionAttributes = $totalData['extension_attributes'] ?? null; if ( - isset($totalData['extension_attributes']['buckaroo_fee']) && - is_scalar($totalData['extension_attributes']['buckaroo_fee']) + $extensionAttributes ) { - return floatval($totalData['extension_attributes']['buckaroo_fee']); + return (floatval($extensionAttributes->getBuckarooFee()['buckaroo_fee'][0])); } return 0; } diff --git a/composer.json b/composer.json index 3f0a56a..6634f2e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "buckaroo/magento2-hyva-checkout", "description": "Buckaroo Magento 2 hyva checkout extension", "require": { - "php": "~8.1.0" + "php": ">=8.1" }, "type": "magento2-module", "license": "CC-BY-NC-ND-3.0",