From 4f26a868a799a29fa5b825b221b554cbde9d7317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 9 Oct 2020 12:44:57 +0200 Subject: [PATCH] Add findOrFail() --- app/Http/Controllers/ClientPortal/PaymentController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 7016ce746e03..17f0fac8419e 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -73,7 +73,7 @@ class PaymentController extends Controller */ public function process() { - $gateway = CompanyGateway::find(request()->input('company_gateway_id')); + $gateway = CompanyGateway::findOrFail('id', request()->input('company_gateway_id')); /*find invoices*/ @@ -160,11 +160,13 @@ class PaymentController extends Controller } $payment_methods = auth()->user()->client->getPaymentMethods(array_sum(array_column($payable_invoices, 'amount_with_fee'))); + $payment_method_id = request()->input('payment_method_id'); $invoice_totals = array_sum(array_column($payable_invoices, 'amount')); $first_invoice = $invoices->first(); + $fee_totals = round($gateway->calcGatewayFee($invoice_totals, true), $first_invoice->client->currency()->precision); if (!$first_invoice->uses_inclusive_taxes) {