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>
Thu, 3 Apr 2014 12:25:53 +0000 (01:25 +1300)
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,
+  );
 }