Merge pull request #19120 from eileenmcnaughton/fee
[civicrm-core.git] / api / v3 / ContributionSoft.php
CommitLineData
5c065cc0 1<?php
5c065cc0
JL
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
5c065cc0 5 | |
a30c801b
TO
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 |
5c065cc0 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
5c065cc0
JL
11
12/**
244bbdd8 13 * This api exposes CiviCRM soft credits.
5c065cc0
JL
14 *
15 * @package CiviCRM_APIv3
5c065cc0
JL
16 */
17
18/**
9d32e6f7 19 * Create or Update a Soft Credit.
5c065cc0 20 *
cf470720 21 * @param array $params
9d32e6f7 22 * Array per getfields metadata.
5c065cc0 23 *
9d32e6f7
EM
24 * @return array
25 * API result array
5c065cc0
JL
26 */
27function civicrm_api3_contribution_soft_create($params) {
a25b46e9 28 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ContributionSoft');
5c065cc0
JL
29}
30
31/**
0aa0303c
EM
32 * Adjust Metadata for Create action.
33 *
34 * The metadata is used for setting defaults, documentation & validation.
5c065cc0 35 *
cf470720 36 * @param array $params
b081365f 37 * Array of parameters determined by getfields.
5c065cc0
JL
38 */
39function _civicrm_api3_contribution_soft_create_spec(&$params) {
40 $params['contribution_id']['api.required'] = 1;
41 $params['contact_id']['api.required'] = 1;
42 $params['amount']['api.required'] = 1;
43}
44
45/**
9d32e6f7 46 * Deletes an existing Soft Credit.
5c065cc0 47 *
cf470720 48 * @param array $params
fae69387 49 *
50 * @return array
51 * Api formatted result.
52 *
8089541a 53 * @throws API_Exception
5c065cc0
JL
54 */
55function civicrm_api3_contribution_soft_delete($params) {
fae69387 56 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
5c065cc0
JL
57}
58
59/**
9d32e6f7 60 * Retrieve one or more Soft Credits.
5c065cc0 61 *
2e66abf8
EM
62 * @param array $params
63 * Array per getfields metadata.
5c065cc0 64 *
2e66abf8 65 * @return array
78373706 66 * API result
5c065cc0
JL
67 */
68function civicrm_api3_contribution_soft_get($params) {
69 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
70}