Commit 42570edb authored by mattwire's avatar mattwire

Check if payment is already recorded before trying to process captured payment

parent 1d15e7af
......@@ -95,6 +95,16 @@ class CRM_Core_Payment_AuthNetIPN {
// invoice_id is the same for all completed payments in a authnet subscription (recurring contribution)
// transaction_id is unique for each completed payment in a authnet subscription (recurring contribution)
// subscription_id is set on the recurring contribution and is unique per authnet subscription.
// Check if we already recorded this payment?
if (civicrm_api3('Mjwpayment', 'get_payment', [
'trxn_id' => $this->getParamFromResponse($response, 'transaction_id'),
'status_id' => 'Completed'
])['count'] > 0) {
// Payment already recorded
return TRUE;
}
$contribution = $this->getContributionFromTrxnInfo($this->getParamFromResponse($response, 'invoice_id'));
$pendingStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending');
if ($contribution && ($contribution['contribution_status_id'] == $pendingStatusId)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment