Merge pull request #17656 from civicrm/5.27
[civicrm-core.git] / api / v3 / MembershipPayment.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * This api exposes CiviCRM membership contribution link.
14 *
15 * @package CiviCRM_APIv3
16 * @todo delete function doesn't exist
17 */
18
19 /**
20 * Add or update a link between contribution and membership.
21 *
22 * @param array $params
23 * Input parameters.
24 *
25 * @return array
26 * API result array.
27 */
28 function civicrm_api3_membership_payment_create($params) {
29 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MembershipPayment');
30 }
31
32 /**
33 * Adjust Metadata for Create action.
34 *
35 * The metadata is used for setting defaults, documentation & validation.
36 *
37 * @param array $params
38 * Array of parameters determined by getfields.
39 */
40 function _civicrm_api3_membership_payment_create_spec(&$params) {
41 $params['membership_id']['api.required'] = 1;
42 $params['contribution_id']['api.required'] = 1;
43 $params['membership_type_id'] = [
44 'title' => 'Membership type id',
45 'description' => 'The id of the membership type',
46 'type' => CRM_Utils_Type::T_INT,
47 ];
48 }
49
50 /**
51 * Retrieve one or more membership payment records.
52 *
53 * @param array $params
54 * Input parameters.
55 *
56 * @return array
57 * API result array.
58 */
59 function civicrm_api3_membership_payment_get($params) {
60 return _civicrm_api3_basic_get('CRM_Member_DAO_MembershipPayment', $params);
61 }