diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 4ac2e8d4ba35..a4db925a042d 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -167,7 +167,13 @@ class PaymentController extends Controller /*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']); $invoice = $invoices->first(function ($inv) use ($payable_invoice) { @@ -190,8 +196,9 @@ class PaymentController extends Controller $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)) { $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'); $invoice_totals = $payable_invoices->sum('amount'); $first_invoice = $invoices->first(); $credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance(); $starting_invoice_amount = $first_invoice->amount; -nlog($credit_totals); -nlog($first_invoice->client->getSetting('use_credits_payment')); - if ($gateway) { $first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save(); } diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index 5258ffba3b00..9954f0374020 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -88,7 +88,7 @@ trait PdfMakerUtilities return $processed; } - public function updateElementProperty($element, string $attribute, string $value) + public function updateElementProperty($element, string $attribute, ?string $value) { // We have exception for "hidden" property. // hidden="true" or hidden="false" will both hide the element, diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index 0652188117c2..13f5ed689a6f 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -41,8 +41,8 @@ class InvoiceFactory extends Factory 'tax_rate2' => 17.5, //'tax_name3' => 'THIRDTAX', //'tax_rate3' => 5, - 'custom_value1' => $this->faker->date, - 'custom_value2' => rand(0, 1) ? 'yes' : 'no', + // 'custom_value1' => $this->faker->date, + //'custom_value2' => rand(0, 1) ? 'yes' : 'no', // 'custom_value3' => $this->faker->numberBetween(1,4), // 'custom_value4' => $this->faker->numberBetween(1,4), 'is_deleted' => false,