CRM-14420 - api contribution.completetransaction should accept 'trxn_id' as a param
authorEileen McNaughton <eileen@fuzion.co.nz>
Thu, 3 Apr 2014 10:39:21 +0000 (23:39 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 7 Apr 2014 21:10:45 +0000 (09:10 +1200)
api/v3/Contribution.php

index 19047e9c3bc60bd4e214e635ca39e914160c284c..cd9f8f79d317a59fce43b5878749053889b40660 100644 (file)
@@ -380,7 +380,7 @@ function civicrm_api3_contribution_completetransaction(&$params) {
     $objects['contribution'] = &$contribution;
     $input['component'] = $contribution->_component;
     $input['is_test'] = $contribution->is_test;
-    $input['trxn_id']= $contribution->trxn_id;
+    $input['trxn_id']= !empty($params['trxn_id']) ? $params['trxn_id'] : $contribution->trxn_id;
     $input['amount'] = $contribution->total_amount;
     if(isset($params['is_email_receipt'])){
       $input['is_email_receipt'] = $params['is_email_receipt'];
@@ -396,5 +396,17 @@ function civicrm_api3_contribution_completetransaction(&$params) {
 }
 
 function _civicrm_api3_contribution_completetransaction(&$params) {
-
+  $params['id'] = array(
+    'title' => 'Contribution ID',
+    'type' => CRM_Utils_Type::T_INT,
+    'api.required' => TRUE,
+  );
+  $params['trxn_id'] = array(
+    'title' => 'Transaction ID',
+    'type' => CRM_Utils_Type::T_STRING,
+  );
+  $params['is_email_receipt'] = array(
+    'title' => 'Send email Receipt?',
+    'type' => CRM_Utils_Type::T_BOOLEAN,
+  );
 }