From 2609e0027a6452d964315c9607458f7d55a7394f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Dec 2020 14:49:11 +0100 Subject: [PATCH] allow paymentfailed exception for guest middleware --- app/Exceptions/PaymentFailed.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Exceptions/PaymentFailed.php b/app/Exceptions/PaymentFailed.php index 06d3f9dda5..55762f03fd 100644 --- a/app/Exceptions/PaymentFailed.php +++ b/app/Exceptions/PaymentFailed.php @@ -13,7 +13,14 @@ class PaymentFailed extends Exception public function render($request) { - return render('gateways.unsuccessful', [ + if (auth()->user()) { + return render('gateways.unsuccessful', [ + 'message' => $this->getMessage(), + 'code' => $this->getCode(), + ]); + } + + return response([ 'message' => $this->getMessage(), 'code' => $this->getCode(), ]);