From 62359e4097009288a62ca33d40c72720c88866f8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Jul 2021 09:51:55 +1000 Subject: [PATCH] minor fixes for wepay --- app/Http/ValidationRules/Payment/ValidRefundableRequest.php | 2 +- app/PaymentDrivers/WePay/ACH.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index b29c6ab06a18..8dc5567beb65 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -80,7 +80,7 @@ class ValidRefundableRequest implements Rule $invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->withTrashed()->first(); if ($payment->invoices()->exists()) { - $paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first(); + $paymentable_invoice = $payment->invoices->where('invoice_id', $invoice->id)->first(); if (! $paymentable_invoice) { $this->error_msg = ctrans('texts.invoice_not_related_to_payment', ['invoice' => $invoice->hashed_id]); diff --git a/app/PaymentDrivers/WePay/ACH.php b/app/PaymentDrivers/WePay/ACH.php index 1060ee5c04ad..31fb62d46bc7 100644 --- a/app/PaymentDrivers/WePay/ACH.php +++ b/app/PaymentDrivers/WePay/ACH.php @@ -194,7 +194,7 @@ class ACH $token = ClientGatewayToken::find($this->decodePrimaryKey($request->input('source'))); $token_meta = $token->meta; - if($token_meta->state != "authorized") + if(!property_exists($token_meta, 'state') || $token_meta->state != "authorized") return redirect()->route('client.payment_methods.verification', ['payment_method' => $token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]); $app_fee = (config('ninja.wepay.fee_ach_multiplier') * $this->wepay_payment_driver->payment_hash->data->amount_with_fee) + config('ninja.wepay.fee_fixed');