CRM-16737 4.7 version, only payment_status_id accepted as return parameter from payme...
[civicrm-core.git] / CRM / Member / BAO / Membership.php
index 6115e4b8452542ea0e9a6a5ea58ca4dc1d701fc1..bc4b216bdaee5d068c9ef4e720dc8bd454d37c88 100644 (file)
@@ -1308,7 +1308,9 @@ AND civicrm_membership.is_test = %2";
     }
 
     if ($form->_contributeMode == 'direct') {
-      if (CRM_Utils_Array::value('contribution_status_id', $paymentResult) == 1) {
+      if (CRM_Utils_Array::value('payment_status_id', $paymentResult) == 1) {
+        // Refer to CRM-16737. Payment processors 'should' return payment_status_id
+        // to denote the outcome of the transaction.
         try {
           civicrm_api3('contribution', 'completetransaction', array(
             'id' => $paymentResult['contribution']->id,
@@ -1322,6 +1324,8 @@ AND civicrm_membership.is_test = %2";
           CRM_Core_Error::debug_log_message('contribution ' . $membershipContribution->id . ' not completed with trxn_id ' . $membershipContribution->trxn_id . ' and message ' . $e->getMessage());
         }
       }
+      // Do not send an email if Recurring transaction is done via Direct Mode
+      // Email will we sent when the IPN is received.
       return;
     }