From 3c90f9ccbd630974a2ec02aa3e5929cf43b95ab1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sat, 23 Dec 2017 23:37:28 +0200 Subject: [PATCH] Fix for gateway payment items total amount --- app/Models/Invoice.php | 1 + app/Ninja/PaymentDrivers/BasePaymentDriver.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index a83bd283ab13..7629f7d984fd 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1003,6 +1003,7 @@ class Invoice extends EntityModel implements BalanceAffecting 'tax_name2', 'tax_rate2', 'invoice_item_type_id', + 'discount', ]); } diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index 8e4384bb3e55..40aa7a9993ff 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -375,8 +375,7 @@ class BasePaymentDriver $items[] = $item; - $invoiceItem->setRelation('invoice', $invoice); - $total += $invoiceItem->amount(); + $total += $invoiceItem->cost * $invoiceItem->qty; } if ($total != $invoice->getRequestedAmount()) {