From 76ffa1d0bafb694d72c7b14f5c4c4156d88add69 Mon Sep 17 00:00:00 2001 From: kGablo Date: Fri, 27 Sep 2024 11:02:37 +0200 Subject: [PATCH] Add minimum amount validation --- Api/TpayInterface.php | 2 -- Model/TpayConfigProvider.php | 4 ---- Model/TpayPayment.php | 17 ----------------- 3 files changed, 23 deletions(-) diff --git a/Api/TpayInterface.php b/Api/TpayInterface.php index 8ee87eb..21a1834 100644 --- a/Api/TpayInterface.php +++ b/Api/TpayInterface.php @@ -20,8 +20,6 @@ interface TpayInterface public function isCustomerLoggedIn(): bool; - public function isTpayAvailable(); - /** @param string $orderId */ public function getCustomerId($orderId); diff --git a/Model/TpayConfigProvider.php b/Model/TpayConfigProvider.php index 80fc7be..e9c3946 100644 --- a/Model/TpayConfigProvider.php +++ b/Model/TpayConfigProvider.php @@ -43,10 +43,6 @@ public function __construct( public function getConfig(): array { - if (!$this->paymentMethod->isTpayAvailable()) { - return []; - } - $config = $this->configFacade->getConfig(); $channels = $this->transactionApi->channels(); diff --git a/Model/TpayPayment.php b/Model/TpayPayment.php index 5ca778e..7928a31 100755 --- a/Model/TpayPayment.php +++ b/Model/TpayPayment.php @@ -351,23 +351,6 @@ public function isCartValid(?float $grandTotal = null): bool return !is_null($grandTotal); } - public function isTpayAvailable(?CartInterface $quote = null) - { - if (!$this->configurationProvider->isTpayActive()) { - return false; - } - - $minAmount = $this->configurationProvider->getMinOrderTotal(); - $maxAmount = $this->configurationProvider->getMaxOrderTotal(); - $amount = (float) $this->getCheckout()->getQuote()->getBaseGrandTotal(); - - if ($amount < $minAmount || ($maxAmount && $amount > $maxAmount)) { - return false; - } - - return $this->isAvailable($quote); - } - protected function checkBlikAmount(): bool { return (bool) ($this->getCheckoutTotal() >= $this->minAmountBlik);