Skip to content

Commit

Permalink
Add minimum amount validation
Browse files Browse the repository at this point in the history
  • Loading branch information
krzGablo committed Sep 27, 2024
1 parent b91a794 commit 76ffa1d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
2 changes: 0 additions & 2 deletions Api/TpayInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ interface TpayInterface

public function isCustomerLoggedIn(): bool;

public function isTpayAvailable();

/** @param string $orderId */
public function getCustomerId($orderId);

Expand Down
4 changes: 0 additions & 4 deletions Model/TpayConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ public function __construct(

public function getConfig(): array
{
if (!$this->paymentMethod->isTpayAvailable()) {
return [];
}

$config = $this->configFacade->getConfig();
$channels = $this->transactionApi->channels();

Expand Down
17 changes: 0 additions & 17 deletions Model/TpayPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 76ffa1d

Please sign in to comment.