From 6a5666ffddef5af1d18e882ff04b3fa43602ffc6 Mon Sep 17 00:00:00 2001
From: Jamie McClelland <jm@mayfirst.org>
Date: Wed, 30 Oct 2019 11:36:11 -0400
Subject: [PATCH] properly handle newer way to record trxn_id value

https://lab.civicrm.org/extensions/stripe/issues/124
---
 api/v3/Stripe/Listevents.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/api/v3/Stripe/Listevents.php b/api/v3/Stripe/Listevents.php
index d3e4dc8d..19b87535 100644
--- a/api/v3/Stripe/Listevents.php
+++ b/api/v3/Stripe/Listevents.php
@@ -230,6 +230,13 @@ function civicrm_api3_stripe_Listevents($params) {
         if ($results['count'] > 0) {
           $item['processed'] = 'yes';
         }
+        else {
+          // Newer versions of stripe store the invoice id in trxn_id.
+          $results = civicrm_api3('Contribution', 'get', array('trxn_id' => $item['invoice']));
+          if ($results['count'] > 0) {
+            $item['processed'] = 'yes';
+          }
+        }
       }
       $out[] = $item;
     }
-- 
GitLab