3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM FinancialItem.
15 * @package CiviCRM_APIv3
19 * Save a Financial Item.
21 * @param array $params
25 function civicrm_api3_financial_trxn_create($params) {
26 if (empty($params['id']) && empty($params['contribution_id']) && empty($params['entity_id'])) {
27 throw new API_Exception("Mandatory key(s) missing from params array: both contribution_id and entity_id are missing");
30 return _civicrm_api3_basic_create('CRM_Core_BAO_FinancialTrxn', $params, 'FinancialTrxn');
34 * Get a Financialtrxn.
36 * @param array $params
39 * Array of retrieved Financial trxn property values.
41 function civicrm_api3_financial_trxn_get($params) {
42 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
46 * Delete a Financial trxn.
48 * @param array $params
51 * Array of deleted values.
53 function civicrm_api3_financial_trxn_delete($params) {
54 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
58 * Adjust Metadata for Create action.
60 * The metadata is used for setting defaults, documentation & validation.
62 * @param array $params
63 * Array of parameters determined by getfields.
65 function _civicrm_api3_financial_trxn_create_spec(&$params) {
66 $params['to_financial_account_id']['api.required'] = 1;
67 $params['status_id']['api.required'] = 1;
68 $params['payment_instrument_id']['api.required'] = 1;
69 $params['total_amount']['api.required'] = 1;