CRM-16417 complete transaction when result shows it succeeded
authorEileen McNaughton <eileen@fuzion.co.nz>
Wed, 24 Jun 2015 23:50:33 +0000 (11:50 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 24 Jun 2015 23:50:33 +0000 (11:50 +1200)
CRM/Contribute/Form/Contribution/Confirm.php

index 9b8a8c76cae0bcbe10e23c2c9f82a9d01f2955de..3b82a5cd4ef0174aa2a6c9bf4b578f9b28657178 100644 (file)
@@ -2097,7 +2097,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
       $financialTypeID = $this->wrangleFinancialTypeID($contributionTypeId);
 
-      return CRM_Contribute_BAO_Contribution_Utils::processConfirm($this, $paymentParams,
+      $result = CRM_Contribute_BAO_Contribution_Utils::processConfirm($this, $paymentParams,
         $premiumParams, $contactID,
         $financialTypeID,
         'contribution',
@@ -2105,6 +2105,11 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         ($this->_mode == 'test') ? 1 : 0,
         $isPayLater
       );
+
+      if (CRM_Utils_Array::value('contribution_status_id', $result) == 1) {
+        civicrm_api3('contribution', 'completetransaction', array('id' => $result['contribution']->id));
+      }
+      return $result;
     }
   }