Commit | Line | Data |
---|---|---|
607f4c2d RT |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
607f4c2d | 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 | | |
607f4c2d RT |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * This api exposes CiviCRM Payment Token records. | |
14 | * | |
15 | * @note Contribute component must be enabled. | |
16 | * | |
17 | * @package CiviCRM_APIv3 | |
18 | */ | |
19 | ||
20 | /** | |
21 | * Create/update Payment Token. | |
22 | * | |
23 | * This API is used to create new campaign or update any of the existing | |
24 | * In case of updating existing campaign, id of that particular campaign must | |
25 | * be in $params array. | |
26 | * | |
27 | * @param array $params | |
28 | * | |
29 | * @return array | |
30 | */ | |
31 | function civicrm_api3_payment_token_create($params) { | |
32 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PaymentToken'); | |
33 | } | |
34 | ||
35 | /** | |
36 | * Adjust Metadata for Create action. | |
37 | * | |
38 | * The metadata is used for setting defaults, documentation & validation. | |
39 | * | |
40 | * @param array $params | |
41 | * Array of parameters determined by getfields. | |
42 | */ | |
43 | function _civicrm_api3_payment_token_create_spec(&$params) { | |
44 | $params['token']['api.required'] = 1; | |
45 | $params['contact_id']['api.required'] = 1; | |
46 | $params['payment_processor_id']['api.required'] = 1; | |
47 | $params['created_id']['api.default'] = 'user_contact_id'; | |
48 | $params['created_date']['api.default'] = 'now'; | |
49 | } | |
50 | ||
51 | /** | |
52 | * Returns array of campaigns matching a set of one or more properties. | |
53 | * | |
54 | * @param array $params | |
55 | * Array per getfields | |
56 | * | |
57 | * @return array | |
58 | * Array of matching campaigns | |
59 | */ | |
60 | function civicrm_api3_payment_token_get($params) { | |
61 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'PaymentToken'); | |
62 | } | |
63 | ||
64 | /** | |
65 | * Delete an existing payment token. | |
66 | * | |
67 | * This method is used to delete any existing payment token. | |
68 | * Id of the payment token to be deleted is required field in $params array | |
69 | * | |
70 | * @param array $params | |
71 | * array containing id of the group to be deleted | |
72 | * | |
73 | * @return array | |
74 | */ | |
75 | function civicrm_api3_payment_token_delete($params) { | |
76 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
77 | } |