minor fixes for wepay

This commit is contained in:
David Bomba 2021-07-23 09:51:55 +10:00
parent da7e368d63
commit 62359e4097
2 changed files with 2 additions and 2 deletions

View File

@ -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]);

View File

@ -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');