From 0a0e529089653f2fd92735dbbba3ad5e1e541018 Mon Sep 17 00:00:00 2001 From: Matthew Wire <mjw@mjwconsult.co.uk> Date: Sun, 24 Jul 2022 15:30:32 +0100 Subject: [PATCH] Fix recording refund --- CRM/Core/Payment/StripeIPN.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php index c7ae1923..6dce2939 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; } /** -- GitLab