Commit df597737 authored by mattwire's avatar mattwire

Fix issues with subsequent recurring payments

parent decc808c
......@@ -92,13 +92,16 @@ class CRM_Core_Payment_AuthNetIPN {
switch ($this->eventType) {
case 'net.authorize.payment.authcapture.created':
// Notifies you that an authorization and capture transaction was created.
// 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.
$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)) {
$params = [
'contribution_id' => $contribution['id'],
'trxn_id' => $this->getParamFromResponse($response, 'transaction_id'),
'order_reference' => $this->getParamFromResponse($response, 'invoice_id'),
'order_reference' => $this->getParamFromResponse($response, 'transaction_id'),
'trxn_date' => $this->event_date,
'total_amount' => $this->getParamFromResponse($response, 'total_amount'),
'contribution_status_id' => $contribution['contribution_status_id']
......@@ -108,7 +111,7 @@ class CRM_Core_Payment_AuthNetIPN {
elseif ($this->getParamFromResponse($response, 'is_recur')) {
$params = [
'trxn_id' => $this->getParamFromResponse($response, 'transaction_id'),
'order_reference' => $this->getParamFromResponse($response, 'invoice_id'),
'order_reference' => $this->getParamFromResponse($response, 'transaction_id'),
'receive_date' => $this->event_date,
'contribution_recur_id' => $this->contribution_recur_id,
'contribution_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'),
......
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