diff --git a/Block/Totals/Fee.php b/Block/Totals/Fee.php deleted file mode 100644 index 574fbc2..0000000 --- a/Block/Totals/Fee.php +++ /dev/null @@ -1,63 +0,0 @@ -feeHelper = $feeHelper; - $this->sessionCheckout = $sessionCheckout; - } - - /** - * Get title based on payment method config - * - * @return string - */ - public function getTitle(): string - { - try { - $payment = $this->sessionCheckout - ->getQuote() - ->getPayment(); - return $this->feeHelper->getBuckarooPaymentFeeLabel($payment->getMethod()); - } catch (\Throwable $th) { - return __('Fee'); - } - return __('Fee'); - } - - /** - * Get total from array of data - * - * @return float - */ - public function getTotal(): float - { - $totalData = $this->getSegment(); - $extensionAttributes = $totalData['extension_attributes'] ?? null; - if ( - $extensionAttributes - ) { - return (floatval($extensionAttributes->getBuckarooFee()['buckaroo_fee'][0])); - } - return 0; - } -} diff --git a/view/frontend/layout/hyva_checkout_components.xml b/view/frontend/layout/hyva_checkout_components.xml index 69f5457..5cbb3a2 100644 --- a/view/frontend/layout/hyva_checkout_components.xml +++ b/view/frontend/layout/hyva_checkout_components.xml @@ -202,9 +202,8 @@ - - \ No newline at end of file + diff --git a/view/frontend/templates/total-segments/fee.phtml b/view/frontend/templates/total-segments/fee.phtml index 77923b8..7cf866d 100644 --- a/view/frontend/templates/total-segments/fee.phtml +++ b/view/frontend/templates/total-segments/fee.phtml @@ -14,14 +14,16 @@ use Hyva\Checkout\ViewModel\Checkout\Formatter as FormatterViewModel; use Hyva\Theme\Model\ViewModelRegistry; $formatterViewModel = $viewModels->require(FormatterViewModel::class); -$total = $block->getTotal(); -if ($total != 0) { +$total = $block->getSegment(); + +if ($total['value'] != 0) { + ?>
- escapeHtml($block->getTitle()) ?> + escapeHtml($total['title']) ?> - currency($total ?? 0) ?> + currency($total['value'] ?? 0) ?>