Skip to content
Snippets Groups Projects
Commit bea412dd authored by mattwire's avatar mattwire Committed by mattwire
Browse files

Add a lock around recording refund payment

parent 7792120c
Branches
Tags
1 merge request!188Refund fixes
......@@ -655,7 +655,18 @@ class CRM_Core_Payment_StripeIPN {
$refundParams['cancelled_payment_id'] = $cancelledPaymentID;
}
$this->updateContributionRefund($refundParams);
$lock = Civi::lockManager()->acquire('data.contribute.contribution.' . $refundParams['contribution_id']);
if (!$lock->isAcquired()) {
\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'],
'total_amount' => $refundParams['total_amount'],
]);
if (empty($refundPayment['count'])) {
$this->updateContributionRefund($refundParams);
}
$lock->release();
return 'OK - refund recorded';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment