From 3fd0ab8f1ef5b368b365536f01de01db7150dd70 Mon Sep 17 00:00:00 2001
From: Matthew Wire <mjw@mjwconsult.co.uk>
Date: Mon, 20 Mar 2023 22:49:43 +0000
Subject: [PATCH] Add better return messages for webhook success

---
 Civi/Stripe/Webhook/Events.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Civi/Stripe/Webhook/Events.php b/Civi/Stripe/Webhook/Events.php
index d021c26b..cc8835aa 100644
--- a/Civi/Stripe/Webhook/Events.php
+++ b/Civi/Stripe/Webhook/Events.php
@@ -355,12 +355,12 @@ class Events {
       'total_amount' => $refundParams['total_amount'],
     ]);
     if (!empty($refundPayment['count'])) {
-      $return->message = 'OK - refund already recorded';
+      $return->message = 'OK - refund already recorded. Contribution ID: ' . $contribution['id'];
       $return->ok = TRUE;
     }
     else {
       $this->updateContributionRefund($refundParams);
-      $return->message = 'OK - refund recorded';
+      $return->message = 'OK - refund recorded. Contribution ID: ' . $contribution['id'];
       $return->ok = TRUE;
     }
     $lock->release();
@@ -530,6 +530,7 @@ class Events {
     $lock->release();
 
     $this->handleInstallmentsForSubscription($subscriptionID, $contributionRecur['id']);
+    $return->message = __FUNCTION__ . ' contributionID: ' . $contribution['id'];
     $return->ok = TRUE;
     return $return;
   }
@@ -589,6 +590,7 @@ class Events {
         'trxn_id' => $invoiceID,
       ]);
     }
+    $return->message = __FUNCTION__ . ' contributionID: ' . $contribution['id'];
     $return->ok = TRUE;
     return $return;
   }
@@ -650,6 +652,7 @@ class Events {
       ];
       $this->updateContributionFailed($params);
     }
+    $return->message = __FUNCTION__ . ' contributionID: ' . $contribution['id'];
     $return->ok = TRUE;
     return $return;
   }
-- 
GitLab