From bcc7997c0b31e675e65b4265794a58d041fdc685 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Mon, 23 Nov 2015 12:56:46 +1300 Subject: [PATCH] CRM-17611 do not set dummy trxn_id on declines and do not attempt to validate non-existent trxn_id --- CRM/Core/Payment/AuthorizeNetIPN.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index 97f35ba2ec..2eaff45073 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -223,7 +223,9 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { if ($input['trxn_id']) { $input['is_test'] = 0; } - else { + // Only assume trxn_id 'should' have been returned for success. + // Per CRM-17611 it would also not be passed back for a decline. + elseif ($input['response_code'] == 1) { $input['is_test'] = 1; $input['trxn_id'] = md5(uniqid(rand(), TRUE)); } @@ -337,6 +339,10 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr * @return bool */ public function checkMD5($ids, $input) { + if (empty($input['trxn_id'])) { + // For decline we have nothing to check against. + return; + } $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ids['paymentProcessor'], $input['is_test'] ? 'test' : 'live' ); -- 2.25.1