CRM-17557 ensure /bin/bash payments are completed
authoreileen <emcnaughton@wikimedia.org>
Fri, 13 Nov 2015 02:39:41 +0000 (18:39 -0800)
committereileen <emcnaughton@wikimedia.org>
Fri, 13 Nov 2015 02:39:41 +0000 (18:39 -0800)
CRM/Contribute/BAO/Contribution/Utils.php

index 16c713a5572990541b347cdb1ca886789e7b190e..2f9a662d339d69ad8cfc6b22d97c3be00b457e5d 100644 (file)
@@ -158,7 +158,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
         $paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
       }
 
-      if (!empty($form->_paymentProcessor) && $form->_amount > 0.0) {
+      if (!empty($form->_paymentProcessor)) {
         try {
           $payment = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor);
           if ($form->_contributeMode == 'notify') {
@@ -211,7 +211,16 @@ class CRM_Contribute_BAO_Contribution_Utils {
 
     $form->_values['contribution_id'] = $contribution->id;
     $form->_values['contribution_page_id'] = $contribution->contribution_page_id;
-
+    if ($form->_params['amount'] == 0) {
+      // This is kind of a back-up for pay-later $0 transactions.
+      // In other flows they pick up the manual processor & get dealt with above (I
+      // think that might be better...).
+      return array(
+        'payment_status_id' => 1,
+        'contribution' => $contribution,
+        'payment_processor_id' => 0,
+      );
+    }
     CRM_Contribute_BAO_ContributionPage::sendMail($contactID,
       $form->_values,
       $contribution->is_test