Skip to content

Commit

Permalink
Fixed minmax amount bug
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse committed Mar 3, 2022
1 parent 719f05f commit f3b5249
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 f3b5249

Please sign in to comment.