Updates for harvesting fee invoice

This commit is contained in:
David Bomba 2024-06-23 16:11:13 +10:00
parent 3ec604919e
commit 06233240ce
4 changed files with 10 additions and 10 deletions

View File

@ -121,12 +121,15 @@ class PaymentController extends Controller
{
/** @var \App\Models\CompanyGateway $gateway **/
$gateway = CompanyGateway::findOrFail($request->input('company_gateway_id'));
$payment_hash = PaymentHash::where('hash', $request->payment_hash)->firstOrFail();
$payment_hash = PaymentHash::with('fee_invoice')->where('hash', $request->payment_hash)->firstOrFail();
// if($payment_hash)
$invoice = $payment_hash->fee_invoice;
// else
// $invoice = Invoice::with('client')->where('id',$payment_hash->fee_invoice_id)->orderBy('id','desc')->first();
// $invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
if($payment_hash)
$invoice = $payment_hash->fee_invoice;
else
$invoice = Invoice::with('client')->where('id',$payment_hash->fee_invoice_id)->orderBy('id','desc');
$client = $invoice ? $invoice->client : auth()->guard('contact')->user()->client;

View File

@ -53,5 +53,6 @@ class UpdateInvoiceActivity implements ShouldQueue
$fields->invoice_id = $event->invoice->id;
$this->activity_repo->save($fields, $event->invoice, $event->event_vars);
}
}

View File

@ -245,7 +245,7 @@ class InstantPayment
$hash_data['billing_context'] = Cache::get($this->request->query('hash'));
} elseif ($this->request->hash) {
$hash_data['billing_context'] = Cache::get($this->request->hash);
} elseif ($old_hash = PaymentHash::query()->where('fee_invoice_id', $first_invoice->id)->whereNull('payment_id')->first()) {
} elseif ($old_hash = PaymentHash::query()->where('fee_invoice_id', $first_invoice->id)->whereNull('payment_id')->orderBy('id','desc')->first()) {
if (isset($old_hash->data->billing_context)) {
$hash_data['billing_context'] = $old_hash->data->billing_context;
}

View File

@ -27,10 +27,6 @@ class RefundPayment
private float $credits_used = 0;
private $gateway_refund_status;
private $activity_repository;
private bool $refund_failed = false;
private string $refund_failed_message = '';