diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php index c7ae1923ac1d0dbf89b29c9a2ff2c5d689a6da2b..6dce2939207c0c7cdfaf3fdfd1696d7cbf658215 100644 --- a/CRM/Core/Payment/StripeIPN.php +++ b/CRM/Core/Payment/StripeIPN.php @@ -666,14 +666,18 @@ class CRM_Core_Payment_StripeIPN { \Civi::log()->error('Could not acquire lock to record refund for contribution: ' . $refundParams['contribution_id']); } $refundPayment = civicrm_api3('Payment', 'get', [ - 'trxn_id' => $refund['refund_trxn_id'], + 'trxn_id' => $refundParams['trxn_id'], 'total_amount' => $refundParams['total_amount'], ]); - if (empty($refundPayment['count'])) { + if (!empty($refundPayment['count'])) { + $message = 'OK - refund already recorded'; + } + else { $this->updateContributionRefund($refundParams); + $message = 'OK - refund recorded'; } $lock->release(); - return 'OK - refund recorded'; + return $message; } /**