Skip to content

Commit

Permalink
Merge pull request #8 from paynl/feature/minmaxamount
Browse files Browse the repository at this point in the history
Fixed minmax amount bug
  • Loading branch information
woutse authored Mar 5, 2022
2 parents 719f05f + f3b5249 commit 3a6867d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions upload/Pay/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,24 +224,26 @@ private function getConfig($key, $pm)
return $this->config->get('payment_' . $pm . '_' . $key);
}

public function getMethod($address = false, $orderTotal = false)
public function getMethod($address = false, $orderAmount = false)
{
$pm = empty($this->_paymentMethodName) ? null : $this->_paymentMethodName;
$config_status = $this->getConfig('status', $pm);
$pmEnabled = !empty($config_status);
if (!$pmEnabled) {
return false;
}

$paymentOptions = $this->getPaymentOption($this->_paymentOptionId);
$minOrderAmount = $this->getConfig('total', $pm);
$maxOrderAmount = $this->getConfig('total', $pm);
$maxOrderAmount = $this->getConfig('totalmax', $pm);
$geozone = (int)$this->getConfig('geo_zone_id', $pm);
$customerType = $this->getConfig('customer_type', $pm);

if ($orderTotal >= 0) {
if ( (!empty($minOrderAmount) && $orderTotal < $minOrderAmount) ||
(!empty($maxOrderAmount) && $orderTotal > $maxOrderAmount) ) {
if ($orderAmount >= 0) {
if (!empty($minOrderAmount) && $orderAmount < $minOrderAmount) {
return false;
}
if (!empty($maxOrderAmount) && $orderAmount > $maxOrderAmount) {
return false;
}
}
Expand Down

0 comments on commit 3a6867d

Please sign in to comment.