mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for multi payments
This commit is contained in:
parent
f84d6d436f
commit
5d302ad450
@ -167,7 +167,13 @@ class PaymentController extends Controller
|
|||||||
|
|
||||||
/*Iterate through invoices and add gateway fees and other payment metadata*/
|
/*Iterate through invoices and add gateway fees and other payment metadata*/
|
||||||
|
|
||||||
$payable_invoices = $payable_invoices->map(function ($payable_invoice) use ($invoices, $settings) {
|
//$payable_invoices = $payable_invoices->map(function ($payable_invoice) use ($invoices, $settings) {
|
||||||
|
$payable_invoice_collection = collect();
|
||||||
|
|
||||||
|
foreach($payable_invoices as $payable_invoice)
|
||||||
|
{
|
||||||
|
nlog($payable_invoice);
|
||||||
|
|
||||||
$payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']);
|
$payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']);
|
||||||
|
|
||||||
$invoice = $invoices->first(function ($inv) use ($payable_invoice) {
|
$invoice = $invoices->first(function ($inv) use ($payable_invoice) {
|
||||||
@ -190,8 +196,9 @@ class PaymentController extends Controller
|
|||||||
|
|
||||||
$payable_invoice['additional_info'] = $additional_info;
|
$payable_invoice['additional_info'] = $additional_info;
|
||||||
|
|
||||||
return $payable_invoice;
|
$payable_invoice_collection->push($payable_invoice);
|
||||||
});
|
}
|
||||||
|
//});
|
||||||
|
|
||||||
if (request()->has('signature') && !is_null(request()->signature) && !empty(request()->signature)) {
|
if (request()->has('signature') && !is_null(request()->signature) && !empty(request()->signature)) {
|
||||||
$invoices->each(function ($invoice) use ($request) {
|
$invoices->each(function ($invoice) use ($request) {
|
||||||
@ -199,15 +206,14 @@ class PaymentController extends Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$payable_invoices = $payable_invoice_collection;
|
||||||
|
|
||||||
$payment_method_id = $request->input('payment_method_id');
|
$payment_method_id = $request->input('payment_method_id');
|
||||||
$invoice_totals = $payable_invoices->sum('amount');
|
$invoice_totals = $payable_invoices->sum('amount');
|
||||||
$first_invoice = $invoices->first();
|
$first_invoice = $invoices->first();
|
||||||
$credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance();
|
$credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance();
|
||||||
$starting_invoice_amount = $first_invoice->amount;
|
$starting_invoice_amount = $first_invoice->amount;
|
||||||
|
|
||||||
nlog($credit_totals);
|
|
||||||
nlog($first_invoice->client->getSetting('use_credits_payment'));
|
|
||||||
|
|
||||||
if ($gateway) {
|
if ($gateway) {
|
||||||
$first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save();
|
$first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user