From 3883c3d4f60b8563fea2c2381c84493385e0992f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 17 Mar 2017 15:16:30 +0200 Subject: [PATCH] Working on gateway fees --- app/Models/Traits/ChargesFees.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Models/Traits/ChargesFees.php b/app/Models/Traits/ChargesFees.php index d3085bab95a4..5b4a9fdf6034 100644 --- a/app/Models/Traits/ChargesFees.php +++ b/app/Models/Traits/ChargesFees.php @@ -28,15 +28,14 @@ trait ChargesFees } if ($settings->fee_percent) { + $amount = $this->partial > 0 ? $this->partial : $this->balance; + // prevent charging taxes twice on the surcharge - if ($location == FEE_LOCATION_ITEM) { - $amount = $this->partial > 0 ? $this->partial : $this->balance; - } else { - $amount = $this->amount; + if ($location != FEE_LOCATION_ITEM) { if ($this->$taxField) { $taxAmount = 0; foreach ($this->getTaxes() as $key => $tax) { - $taxAmount += $tax['amount']; + $taxAmount += $tax['amount'] - $tax['paid']; } $amount -= $taxAmount; }