From 792e208554bfa30e8ef60307b46b79ad385d3f7c Mon Sep 17 00:00:00 2001
From: "Matthew Wire (MJW Consulting)" <mjw@mjwconsult.co.uk>
Date: Sun, 19 May 2019 12:05:46 +0100
Subject: [PATCH] Handle webhook permission errors thanks @jongold
 extensions/stripe\!30

---
 CRM/Stripe/Utils/Check/Webhook.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/CRM/Stripe/Utils/Check/Webhook.php b/CRM/Stripe/Utils/Check/Webhook.php
index 27c277b0..0f12b533 100644
--- a/CRM/Stripe/Utils/Check/Webhook.php
+++ b/CRM/Stripe/Utils/Check/Webhook.php
@@ -28,12 +28,14 @@ class CRM_Stripe_Utils_Check_Webhook {
       try {
         $webhooks = \Stripe\WebhookEndpoint::all(["limit" => 100]);
       }
-      catch (\Stripe\Error\Authentication $e) {
+      catch (Exception $e) {
+        $error = $e->getMessage();
         $messages[] = new CRM_Utils_Check_Message(
           'stripe_webhook',
-          E::ts('The %1 (%2) Payment Processor has an invalid API key', [
+          E::ts('The %1 (%2) Payment Processor has an error: %3', [
             1 => $pp['name'],
             2 => $pp['id'],
+            3 => $error,
           ]),
           E::ts('Stripe - API Key'),
           \Psr\Log\LogLevel::ERROR,
-- 
GitLab