CRM-16926 complete recurring transactions when payment_status_id = 1,
authorEileen McNaughton <eileen@fuzion.co.nz>
Tue, 28 Jul 2015 21:21:50 +0000 (09:21 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Thu, 30 Jul 2015 00:25:32 +0000 (12:25 +1200)
 carefully to grandfather in

Conflicts:
CRM/Contribute/BAO/Contribution/Utils.php

api/v3/Contribution.php

index 20cc1aedc760b50e26a002be8fcd2bfd5c0b001e..0cf23a94c8e972bac028b040c02f04461dfc51ff 100644 (file)
@@ -419,19 +419,16 @@ function civicrm_api3_contribution_completetransaction(&$params) {
   if (!$contribution->id == $params['id']) {
     throw new API_Exception('A valid contribution ID is required', 'invalid_data');
   }
-  try {
-    if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) {
-      throw new API_Exception('failed to load related objects');
-    }
-    elseif ($contribution->contribution_status_id == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) {
-      throw new API_Exception(ts('Contribution already completed'));
-    }
-    $input['trxn_id'] = !empty($params['trxn_id']) ? $params['trxn_id'] : $contribution->trxn_id;
-    $params = _ipn_process_transaction($params, $contribution, $input, $ids);
+
+  if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) {
+    throw new API_Exception('failed to load related objects');
   }
-  catch(Exception $e) {
-    throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString());
+  elseif ($contribution->contribution_status_id == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) {
+    throw new API_Exception(ts('Contribution already completed'), 'contribution_completed');
   }
+  $input['trxn_id'] = !empty($params['trxn_id']) ? $params['trxn_id'] : $contribution->trxn_id;
+  $params = _ipn_process_transaction($params, $contribution, $input, $ids);
+
 }
 
 /**