From 4bb4b8affbd6bda8b5bfe788a33e3ca54d9854db Mon Sep 17 00:00:00 2001 From: Matthew Wire <mjw@mjwconsult.co.uk> Date: Wed, 12 Jan 2022 10:14:17 +0000 Subject: [PATCH] Improve webhookEventNotMatched hook for contribution_not_found so we can return a contribution to use --- CRM/Core/Payment/StripeIPN.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php index 40eb15e7..a78d7a16 100644 --- a/CRM/Core/Payment/StripeIPN.php +++ b/CRM/Core/Payment/StripeIPN.php @@ -733,11 +733,17 @@ class CRM_Core_Payment_StripeIPN { $message = $this->_paymentProcessor->getPaymentProcessorLabel() . 'No matching contributions for event ' . $this->getEventID(); Civi::log()->debug($message); } - CRM_Mjwshared_Hook::webhookEventNotMatched('stripe', $this, 'contribution_not_found'); - return FALSE; + $result = NULL; + CRM_Mjwshared_Hook::webhookEventNotMatched('stripe', $this, 'contribution_not_found', $result); + if (empty($result['contribution'])) { + return FALSE; + } + $this->contribution = $result['contribution']; + } + else { + $this->contribution = $contribution['values'][$contribution['id']]; } - $this->contribution = $contribution['values'][$contribution['id']]; return TRUE; } -- GitLab