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