Declare total_amount, make amount an alias
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 7 Jul 2022 02:06:15 +0000 (14:06 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 7 Jul 2022 05:06:54 +0000 (17:06 +1200)
The confusion between amount & total_amount is in
multiple places - this means they are treated 'the same' if passed
into repeattransaction

api/v3/Contribution.php

index 3f01a7d4efedcf60a94fd287c9f802cecc3224cd..6154d6343b0762527d86d3b46a53c971fd3f03a8 100644 (file)
@@ -813,6 +813,14 @@ function _civicrm_api3_contribution_repeattransaction_spec(&$params) {
     'name' => 'payment_processor_id',
     'type' => CRM_Utils_Type::T_INT,
   ];
+  $params['total_amount'] = [
+    'description' => ts('Optional override amount, will be ignored if more than one line item exists'),
+    'title' => ts('Total amount of the contribution'),
+    'name' => 'total_amount',
+    'type' => CRM_Utils_Type::T_MONEY,
+    // Map 'amount' to total_amount - historically both have been used at times.
+    'api.aliases' => ['amount'],
+  ];
 }
 
 /**