Route cosmetic layout updates, and standardise on using /home to redirect back to the homescreen, and standardise usage of redirect()

This commit is contained in:
2025-05-16 13:58:20 +10:00
parent 256e4c6260
commit 8d72c1ceb5
10 changed files with 57 additions and 58 deletions

View File

@@ -34,8 +34,7 @@ class PaypalController extends Controller
public function cancel()
{
return redirect()
->to(self::cart_url);
return redirect(self::cart_url);
}
/**
@@ -52,8 +51,7 @@ class PaypalController extends Controller
$cart = request()->session()->get('invoice.cart');
if (! $cart)
return redirect()
->to('u/home');
return redirect('home');
$invoices = Invoice::find($cart);
@@ -113,15 +111,13 @@ class PaypalController extends Controller
} catch (HttpException $e) {
Log::error('Paypal Exception',['request'=>$paypal,'response'=>$e->getMessage()]);
return redirect()
->to(self::cart_url)
return redirect(self::cart_url)
->withErrors('Paypal Exception: '.$e->getCode());
} catch (\HttpException $e) {
Log::error('HTTP Exception',['request'=>$this->client,'response'=>$e->getMessage()]);
return redirect()
->to(self::cart_url)
return redirect(self::cart_url)
->withErrors('HTTP Exception: '.$e->getCode());
}
@@ -138,8 +134,7 @@ class PaypalController extends Controller
return redirect()
->away($redirect_url);
return redirect()
->to(self::cart_url)
return redirect(self::cart_url)
->withErrors('An error occurred with Paypal?');
}
@@ -192,23 +187,20 @@ class PaypalController extends Controller
->away($redirect_url);
}
return redirect()
->to(self::cart_url)
return redirect(self::cart_url)
->withErrors('An error occurred with Paypal?');
} catch (\HttpException $e) {
Log::error('HTTP Exception',['request'=>$paypal,'response'=>$e->getMessage()]);
return redirect()
->to(self::cart_url)
return redirect(self::cart_url)
->withErrors('HTTP Exception: '.$e->getCode());
}
if ((! $response) || (! $response->result->purchase_units)) {
Log::error('Paypal Capture: No Purchase Units?');
return redirect()
->to(self::cart_url)
return redirect(self::cart_url)
->withErrors('Paypal Exception: NPU');
}
@@ -267,8 +259,7 @@ class PaypalController extends Controller
Log::info('Paypal Payment Recorded',['po'=>$po->id]);
return redirect()
->to('u/home')
return redirect('home')
->with('success','Payment recorded thank you.');
}
}