From 2431ffaba7fcf455faa7df0058f9e3cc6e57b711 Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Thu, 29 Apr 2021 01:39:45 +0900 Subject: [PATCH] update: payment --- app/Http/Controllers/Guest/PaymentController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Guest/PaymentController.php b/app/Http/Controllers/Guest/PaymentController.php index 2dc8ef85..7daea11d 100644 --- a/app/Http/Controllers/Guest/PaymentController.php +++ b/app/Http/Controllers/Guest/PaymentController.php @@ -13,13 +13,17 @@ class PaymentController extends Controller { public function notify($method, $id, Request $request) { - $paymentService = new PaymentService($method, $id); - $verify = $paymentService->notify($request->input()); - if (!$verify) abort(500, 'verify error'); - if (!$this->handle($verify['trade_no'], $verify['callback_no'])) { - abort(500, 'handle error'); + try { + $paymentService = new PaymentService($method, $id); + $verify = $paymentService->notify($request->input()); + if (!$verify) abort(500, 'verify error'); + if (!$this->handle($verify['trade_no'], $verify['callback_no'])) { + abort(500, 'handle error'); + } + die('success'); + } catch (\Exception $e) { + abort(500, 'fail'); } - die('success'); } private function handle($tradeNo, $callbackNo)