From 8dbf1b238f889f3154344a013dd5e4ac98303b2a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 30 Sep 2022 19:45:18 +1000 Subject: [PATCH] Exception handling for checkout --- app/PaymentDrivers/CheckoutComPaymentDriver.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 2a7a9e94518b..07a2c6f77906 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -306,13 +306,10 @@ class CheckoutComPaymentDriver extends BaseDriver try { $response = $this->gateway->getCustomersClient()->create($request); - } catch (CheckoutApiException $e) { + } catch (\Exception $e) { // API error - $error_details = $e->error_details; - $http_status_code = isset($e->http_metadata) ? $e->http_metadata->getStatusCode() : null; - } catch (CheckoutAuthorizationException $e) { - // Bad Invalid authorization - } + throw new PaymentFailed($e->getMessage(), $e->getCode()); + } return $response; }