minor fixes for handle reversal

This commit is contained in:
David Bomba 2021-07-29 20:30:02 +10:00
parent 0904222eef
commit 8e41c801c8
2 changed files with 12 additions and 1 deletions

View File

@ -24,6 +24,17 @@ class ContactHashLoginController extends Controller
*/ */
public function login(string $contact_key) public function login(string $contact_key)
{ {
if(request()->has('subscription') && $request->subscription == 'true') {
$recurring_invoice = RecurringInvoice::where('client_id', auth()->guard('contact')->client->id)
->whereNotNull('subscription_id')
->whereNull('deleted_at')
->first();
return route('client.recurring_invoice.show', $recurring_invoice->hashed_id);
}
return redirect('/client/invoices'); return redirect('/client/invoices');
} }

View File

@ -90,7 +90,7 @@ class HandleReversal extends AbstractService
} }
/*If there is a payment linked, then the credit needs to be linked back to that payment in case of refund*/ /*If there is a payment linked, then the credit needs to be linked back to that payment in case of refund*/
if ($paymentables->count() > 0) { if ($paymentables->count() > 0 && $credit) {
$payment = $paymentables->first()->payment; $payment = $paymentables->first()->payment;
$payment->credits()->save($credit); $payment->credits()->save($credit);