From b7f814a0b56730bd65cf55e7e9d74431f831c691 Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Mon, 16 Sep 2024 13:47:01 +0200 Subject: [PATCH 1/6] remove credit card --- Magewire/Payment/Method/Creditcard.php | 114 ------------------ etc/frontend/di.xml | 1 - .../layout/hyva_checkout_components.xml | 10 -- .../component/payment/method/creditcard.phtml | 56 --------- 4 files changed, 181 deletions(-) delete mode 100644 Magewire/Payment/Method/Creditcard.php delete mode 100644 view/frontend/templates/component/payment/method/creditcard.phtml diff --git a/Magewire/Payment/Method/Creditcard.php b/Magewire/Payment/Method/Creditcard.php deleted file mode 100644 index 4c5acc5..0000000 --- a/Magewire/Payment/Method/Creditcard.php +++ /dev/null @@ -1,114 +0,0 @@ - 'Saving card type' - ]; - - protected $rules = [ - 'cardType' => 'required' - ]; - - protected $messages = [ - 'cardType:required' => 'A card type is required' - ]; - - protected SessionCheckout $sessionCheckout; - - protected CartRepositoryInterface $quoteRepository; - - protected ScopeConfigInterface $scopeConfig; - - protected MethodConfigProvider $methodConfigProvider; - - public function __construct( - Validator $validator, - SessionCheckout $sessionCheckout, - CartRepositoryInterface $quoteRepository, - ScopeConfigInterface $scopeConfig, - MethodConfigProvider $methodConfigProvider - ) { - parent::__construct($validator); - - $this->sessionCheckout = $sessionCheckout; - $this->quoteRepository = $quoteRepository; - $this->scopeConfig = $scopeConfig; - $this->methodConfigProvider = $methodConfigProvider; - } - - /** - * @throws LocalizedException - * @throws NoSuchEntityException - */ - public function mount(): void - { - $this->cardType = $this->sessionCheckout - ->getQuote() - ->getPayment() - ->getAdditionalInformation('card_type'); - } - - /** - * Listen for bank cardType been updated. - */ - public function updatedCardType(string $value): ?string - { - $this->validateOnly(); - $value = empty($value) ? null : $value; - - try { - $quote = $this->sessionCheckout->getQuote(); - $quote->getPayment()->setAdditionalInformation('card_type', $value); - - $this->quoteRepository->save($quote); - } catch (LocalizedException $exception) { - $this->dispatchErrorMessage($exception->getMessage()); - } - - return $value; - } - public function evaluateCompletion(EvaluationResultFactory $resultFactory): EvaluationResultInterface - { - if ($this->cardType === null) { - return $resultFactory->createErrorMessageEvent() - ->withCustomEvent('payment:method:error') - ->withMessage('A card type is required'); - } - - return $resultFactory->createSuccess(); - } - - public function getIssuers(): array - { - return $this->methodConfigProvider->formatIssuers(); - } - - public function displayAsSelect($storeId = null): bool - { - return $this->scopeConfig->getValue( - MethodIdeal::XPATH_IDEAL_SELECTION_TYPE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $storeId - ) === '2'; - } -} diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index b8d65da..a85dfb5 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -20,7 +20,6 @@ \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService - \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService diff --git a/view/frontend/layout/hyva_checkout_components.xml b/view/frontend/layout/hyva_checkout_components.xml index a14b10f..cdc4c26 100644 --- a/view/frontend/layout/hyva_checkout_components.xml +++ b/view/frontend/layout/hyva_checkout_components.xml @@ -45,16 +45,6 @@ - - - - \Buckaroo\HyvaCheckout\Magewire\Payment\Method\Creditcard - - - - diff --git a/view/frontend/templates/component/payment/method/creditcard.phtml b/view/frontend/templates/component/payment/method/creditcard.phtml deleted file mode 100644 index f7d46e8..0000000 --- a/view/frontend/templates/component/payment/method/creditcard.phtml +++ /dev/null @@ -1,56 +0,0 @@ -getIssuers(); - -?> -
-
- displayAsSelect()) { ?> - - - -

escapeHtml(__('Select a Credit Card or Debit Card:')); ?>

- -
- " - value="escapeHtmlAttr($issuer["code"]) ?>" - /> - -
- - -
-
From 53437a1699fa793fc818bcd90e0c06b9a3d79080 Mon Sep 17 00:00:00 2001 From: Sander Jongsma Date: Mon, 30 Sep 2024 14:11:56 +0200 Subject: [PATCH 2/6] use x-cloak to avoid blip of modal --- view/frontend/templates/component/payment/after.phtml | 1 + 1 file changed, 1 insertion(+) diff --git a/view/frontend/templates/component/payment/after.phtml b/view/frontend/templates/component/payment/after.phtml index 02b78de..e9b006f 100644 --- a/view/frontend/templates/component/payment/after.phtml +++ b/view/frontend/templates/component/payment/after.phtml @@ -4,6 +4,7 @@ tabindex="-1" aria-hidden="true" class="fixed top-0 left-0 right-0 z-50 justify-center w-full p-4 items-center overflow-x-hidden overflow-y-auto md:inset-0 max-h-full h-full" + x-cloak x-bind:class="showModal ? 'flex': 'hidden'">
From 896ef4ef46b9f09c3a8081be4d776ad2e2ce9445 Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Mon, 14 Oct 2024 16:18:04 +0200 Subject: [PATCH 3/6] add Remaining amount under grand total --- .../layout/hyva_checkout_components.xml | 3 + .../layout/hyva_checkout_index_index.xml | 2 +- .../checkout/summary/remaining-amount.phtml | 29 ++++++ .../templates/component/payment/after.phtml | 97 +++++++++---------- 4 files changed, 80 insertions(+), 51 deletions(-) create mode 100644 view/frontend/templates/checkout/summary/remaining-amount.phtml diff --git a/view/frontend/layout/hyva_checkout_components.xml b/view/frontend/layout/hyva_checkout_components.xml index a14b10f..2e3d8a6 100644 --- a/view/frontend/layout/hyva_checkout_components.xml +++ b/view/frontend/layout/hyva_checkout_components.xml @@ -210,6 +210,9 @@ class="Buckaroo\HyvaCheckout\Block\Totals\AlreadyPaid" as="buckaroo_already_paid" template="Buckaroo_HyvaCheckout::total-segments/already-paid.phtml"/> + diff --git a/view/frontend/layout/hyva_checkout_index_index.xml b/view/frontend/layout/hyva_checkout_index_index.xml index 92ce243..9bbb463 100644 --- a/view/frontend/layout/hyva_checkout_index_index.xml +++ b/view/frontend/layout/hyva_checkout_index_index.xml @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/view/frontend/templates/checkout/summary/remaining-amount.phtml b/view/frontend/templates/checkout/summary/remaining-amount.phtml new file mode 100644 index 0000000..24fab35 --- /dev/null +++ b/view/frontend/templates/checkout/summary/remaining-amount.phtml @@ -0,0 +1,29 @@ +require(FormatterViewModel::class); +$segment = $block->getSegment(); +if ($segment['value'] != 0) { + ?> +
+ + escapeHtml($segment['title']) ?> + + + currency($segment['value'] ?? 0) ?> + +
+