1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Working on gateway fees

This commit is contained in:
Hillel Coren 2017-03-17 15:10:33 +02:00
parent fa2e50f15c
commit 0791e6fbc5

View File

@ -1019,15 +1019,15 @@ class InvoiceRepository extends BaseRepository
return false;
}
if (! $invoice->relationLoaded('invoice_items')) {
$invoice->load('invoice_items');
}
// once an invoice with fee surcharge has been paid don't clear it
if (($location == FEE_LOCATION_CHARGE1 || $location == FEE_LOCATION_CHARGE2) && $invoice->amount != $invoice->balance) {
return false;
}
if (! $invoice->relationLoaded('invoice_items')) {
$invoice->load('invoice_items');
}
if ($location == FEE_LOCATION_ITEM) {
$data = $invoice->toArray();
foreach ($data['invoice_items'] as $key => $item) {
@ -1066,7 +1066,7 @@ class InvoiceRepository extends BaseRepository
$data = $invoice->toArray();
if ($location == FEE_LOCATION_ITEM) {
$fee = $invoice->calcGatewayFee($gatewayTypeId, false);
$fee = $invoice->calcGatewayFee($gatewayTypeId);
$item = [];
$item['product_key'] = trans('texts.surcharge');