From 914bcf7f96645175679c4abb2a112e37a30b6b4d Mon Sep 17 00:00:00 2001
From: Jamie McClelland <jm@mayfirst.org>
Date: Tue, 20 Sep 2022 15:16:30 -0400
Subject: [PATCH] ensure webhook data is populated.

Fixes https://lab.civicrm.org/extensions/stripe/-/issues/388
---
 CRM/Core/Payment/Stripe.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CRM/Core/Payment/Stripe.php b/CRM/Core/Payment/Stripe.php
index e310963b..7adfc255 100644
--- a/CRM/Core/Payment/Stripe.php
+++ b/CRM/Core/Payment/Stripe.php
@@ -1329,6 +1329,13 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
       // We don't handle this event
       return FALSE;
     }
+
+    // Populate the data from this webhook.
+    $rawEventData = str_replace('Stripe\StripeObject JSON: ', '', $webhookEvent['data']);
+    $eventData = json_decode($rawEventData, TRUE);
+    $data = StripeObject::constructFrom($eventData);
+    $handler->setData($data);
+
     // We retrieve/validate/store the webhook data when it is received.
     $handler->setVerifyData(FALSE);
     $handler->setExceptionMode(FALSE);
-- 
GitLab