infra updated incorrectly set public functions to private on payment classes
[civicrm-core.git] / api / v3 / examples / Contact / APIChainedArrayMultipleCustom.php
1 <?php
2 /**
3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6 */
7
8 /**
9 * Test Generated example of using contact get API.
10 *
11 * /*this demonstrates the usage of chained api functions. A variety of techniques are used
12 *
13 * @return array
14 * API result array
15 */
16 function contact_get_example() {
17 $params = array(
18 'id' => 1,
19 'api.website.getValue' => array(
20 'return' => 'url',
21 ),
22 'api.Contribution.getCount' => array(),
23 'api.CustomValue.get' => 1,
24 );
25
26 try{
27 $result = civicrm_api3('contact', 'get', $params);
28 }
29 catch (CiviCRM_API3_Exception $e) {
30 // Handle error here.
31 $errorMessage = $e->getMessage();
32 $errorCode = $e->getErrorCode();
33 $errorData = $e->getExtraParams();
34 return array(
35 'error' => $errorMessage,
36 'error_code' => $errorCode,
37 'error_data' => $errorData,
38 );
39 }
40
41 return $result;
42 }
43
44 /**
45 * Function returns array of result expected from previous function.
46 *
47 * @return array
48 * API result array
49 */
50 function contact_get_expectedresult() {
51
52 $expectedResult = array(
53 'is_error' => 0,
54 'version' => 3,
55 'count' => 1,
56 'id' => 1,
57 'values' => array(
58 '1' => array(
59 'contact_id' => '1',
60 'contact_type' => 'Individual',
61 'contact_sub_type' => '',
62 'sort_name' => 'xyz3, abc3',
63 'display_name' => 'abc3 xyz3',
64 'do_not_email' => 0,
65 'do_not_phone' => 0,
66 'do_not_mail' => 0,
67 'do_not_sms' => 0,
68 'do_not_trade' => 0,
69 'is_opt_out' => 0,
70 'legal_identifier' => '',
71 'external_identifier' => '',
72 'nick_name' => '',
73 'legal_name' => '',
74 'image_URL' => '',
75 'preferred_communication_method' => '',
76 'preferred_language' => 'en_US',
77 'preferred_mail_format' => 'Both',
78 'first_name' => 'abc3',
79 'middle_name' => '',
80 'last_name' => 'xyz3',
81 'prefix_id' => '',
82 'suffix_id' => '',
83 'formal_title' => '',
84 'communication_style_id' => '',
85 'job_title' => '',
86 'gender_id' => '',
87 'birth_date' => '',
88 'is_deceased' => 0,
89 'deceased_date' => '',
90 'household_name' => '',
91 'organization_name' => '',
92 'sic_code' => '',
93 'contact_is_deleted' => 0,
94 'current_employer' => '',
95 'address_id' => '2',
96 'street_address' => '1 my road',
97 'supplemental_address_1' => '',
98 'supplemental_address_2' => '',
99 'city' => '',
100 'postal_code_suffix' => '',
101 'postal_code' => '',
102 'geo_code_1' => '',
103 'geo_code_2' => '',
104 'state_province_id' => '',
105 'country_id' => '',
106 'phone_id' => '',
107 'phone_type_id' => '',
108 'phone' => '',
109 'email_id' => '1',
110 'email' => 'man3@yahoo.com',
111 'on_hold' => 0,
112 'im_id' => '',
113 'provider_id' => '',
114 'im' => '',
115 'worldregion_id' => '',
116 'world_region' => '',
117 'individual_prefix' => '',
118 'individual_suffix' => '',
119 'communication_style' => '',
120 'gender' => '',
121 'state_province_name' => '',
122 'state_province' => '',
123 'country' => '',
124 'id' => '1',
125 'api.website.getValue' => 'http://civicrm.org',
126 'api.Contribution.getCount' => 2,
127 'api.CustomValue.get' => array(
128 'is_error' => 0,
129 'version' => 3,
130 'count' => 8,
131 'values' => array(
132 '0' => array(
133 'entity_id' => '1',
134 'latest' => 'value 4',
135 'id' => '1',
136 'entity_table' => 'Contact',
137 ),
138 '1' => array(
139 'entity_table' => 'Contact',
140 ),
141 '2' => array(
142 'entity_id' => '1',
143 'latest' => 'value 3',
144 'id' => '2',
145 '1' => 'value 2',
146 'entity_table' => 'Contact',
147 '2' => 'value 3',
148 ),
149 '3' => array(
150 'entity_id' => '1',
151 'latest' => '',
152 'id' => '3',
153 '1' => 'warm beer',
154 '2' => '',
155 ),
156 '4' => array(
157 'entity_id' => '1',
158 'latest' => '',
159 'id' => '4',
160 '1' => '',
161 '2' => '',
162 ),
163 '5' => array(
164 'entity_id' => '1',
165 'latest' => 'defaultValue',
166 'id' => '5',
167 '1' => 'defaultValue',
168 ),
169 '6' => array(
170 'entity_id' => '1',
171 'latest' => 'vegemite',
172 'id' => '6',
173 '1' => 'vegemite',
174 ),
175 '7' => array(
176 'entity_id' => '1',
177 'latest' => '',
178 'id' => '7',
179 '1' => '',
180 ),
181 ),
182 ),
183 ),
184 ),
185 );
186
187 return $expectedResult;
188 }
189
190 /**
191 * This example has been generated from the API test suite.
192 * The test that created it is called
193 * testGetIndividualWithChainedArraysAndMultipleCustom
194 * and can be found in
195 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
196 *
197 * You can see the outcome of the API tests at
198 * https://test.civicrm.org/job/CiviCRM-master-git/
199 *
200 * To Learn about the API read
201 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
202 *
203 * Browse the api on your own site with the api explorer
204 * http://MYSITE.ORG/path/to/civicrm/api/explorer
205 *
206 * Read more about testing here
207 * http://wiki.civicrm.org/confluence/display/CRM/Testing
208 *
209 * API Standards documentation:
210 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
211 */