CRM-19590: Failed CC Contributions Listed with Status of Pending (Incomplete Transact...
authordeb.monish <monish.deb@webaccessglobal.com>
Thu, 3 Nov 2016 11:57:32 +0000 (17:27 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Thu, 3 Nov 2016 11:59:29 +0000 (17:29 +0530)
CRM/Core/Payment/AuthorizeNet.php

index 19b4bcec9c7f1a3f5535a7042de71f0f45f4858f..f264ae83fde64bfb85c616b6f3c6575984eeec66 100644 (file)
@@ -167,15 +167,19 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment {
     curl_close($submit);
 
     $response_fields = $this->explode_csv($response);
+
+    // fetch available contribution statuses
+    $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
+
     // check gateway MD5 response
     if (!$this->checkMD5($response_fields[37], $response_fields[6], $response_fields[9])) {
+      $params['payment_status_id'] = array_search('Failed', $contributionStatus);
       return self::error(9003, 'MD5 Verification failed');
     }
 
     // check for application errors
     // TODO:
     // AVS, CVV2, CAVV, and other verification results
-    $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     switch ($response_fields[0]) {
       case self::AUTH_REVIEW :
         $params['payment_status_id'] = array_search('Pending', $contributionStatus);