Merge pull request #19727 from totten/master-authx-rest
[civicrm-core.git] / api / v3 / LineItem.php
index 4b9bf30bfc7b379a2292d5e6752c41bef81281a3..b255dc1d06a188a45a5ead175d5b98af0001bf43 100644 (file)
  *
  * @return array
  *   api result array
+ *
+ * @throws \API_Exception
+ * @throws \Civi\API\Exception\UnauthorizedException
  */
 function civicrm_api3_line_item_create($params) {
-  // @todo the following line is not really appropriate for the api. The BAO should
-  // do the work.
-  $taxRates = CRM_Core_PseudoConstant::getTaxRates();
-  if (isset($params['financial_type_id']) && array_key_exists($params['financial_type_id'], $taxRates)) {
-    $taxRate = $taxRates[$params['financial_type_id']];
-    $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($params['line_total'], $taxRate);
-    $params['tax_amount'] = round($taxAmount['tax_amount'], 2);
-  }
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'LineItem');
 }
 
@@ -66,9 +61,6 @@ function _civicrm_api3_line_item_create_spec(&$params) {
  *   Array of matching line_items
  */
 function civicrm_api3_line_item_get($params) {
-  if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
-    CRM_Price_BAO_LineItem::getAPILineItemParams($params);
-  }
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }