diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index dbbe83affc2..7f0490629b0 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -662,8 +662,8 @@ if ($action == 'charge' && isModEnabled('stripe')) { $action = ''; } } - } catch (\Stripe\Error\Card $e) { - // Since it's a decline, \Stripe\Error\Card will be caught + } catch (\Stripe\Exception\CardException $e) { + // Since it's a decline, \Stripe\Exception\Card will be caught $body = $e->getJsonBody(); $err = $body['error']; @@ -679,21 +679,21 @@ if ($action == 'charge' && isModEnabled('stripe')) { dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; - } catch (\Stripe\Error\RateLimit $e) { + } catch (\Stripe\Exception\RateLimitException $e) { // Too many requests made to the API too quickly $error++; $errormessage = "ErrorRateLimit ".$e->getMessage(); dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; - } catch (\Stripe\Error\InvalidRequest $e) { + } catch (\Stripe\Exception\InvalidRequestException $e) { // Invalid parameters were supplied to Stripe's API $error++; $errormessage = "ErrorInvalidRequest ".$e->getMessage(); dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; - } catch (\Stripe\Error\Authentication $e) { + } catch (\Stripe\Exception\AuthenticationException $e) { // Authentication with Stripe's API failed // (maybe you changed API keys recently) $error++; @@ -701,14 +701,14 @@ if ($action == 'charge' && isModEnabled('stripe')) { dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; - } catch (\Stripe\Error\ApiConnection $e) { + } catch (\Stripe\Exception\ApiConnectionException $e) { // Network communication with Stripe failed $error++; $errormessage = "ErrorApiConnection ".$e->getMessage(); dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; - } catch (\Stripe\Error\Base $e) { + } catch (\Stripe\Exception\ExceptionInterface $e) { // Display a very generic error to the user, and maybe send // yourself an email $error++; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index c100bdba1ca..6e3715b7f75 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -603,7 +603,7 @@ class Stripe extends CommonObject } else { $_SESSION["stripe_payment_intent"] = $paymentintent; } - } catch (Stripe\Error\Card $e) { + } catch (Stripe\Exception\CardException $e) { $error++; $this->error = $e->getMessage(); $this->code = $e->getStripeCode(); @@ -1354,9 +1354,9 @@ class Stripe extends CommonObject $return->message = $charge->id; } } - } catch (\Stripe\Error\Card $e) { + } catch (\Stripe\Exception\CardException $e) { include DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - // Since it's a decline, \Stripe\Error\Card will be caught + // Since it's a decline, \Stripe\Exception\Card will be caught $body = $e->getJsonBody(); $err = $body['error']; @@ -1372,24 +1372,24 @@ class Stripe extends CommonObject $error++; dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); - } catch (\Stripe\Error\RateLimit $e) { + } catch (\Stripe\Exception\RateLimitException $e) { // Too many requests made to the API too quickly $error++; dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); - } catch (\Stripe\Error\InvalidRequest $e) { + } catch (\Stripe\Exception\InvalidRequestException $e) { // Invalid parameters were supplied to Stripe's API $error++; dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); - } catch (\Stripe\Error\Authentication $e) { + } catch (\Stripe\Exception\AuthenticationException $e) { // Authentication with Stripe's API failed // (maybe you changed API keys recently) $error++; dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); - } catch (\Stripe\Error\ApiConnection $e) { + } catch (\Stripe\Exception\ApiConnectionException $e) { // Network communication with Stripe failed $error++; dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); - } catch (\Stripe\Error\Base $e) { + } catch (\Stripe\Exception\ExceptionInterface $e) { // Display a very generic error to the user, and maybe send // yourself an email $error++;