Consolidate handling of greeting label
[civicrm-core.git] / api / v3 / examples / PledgePayment / Update.php
1 <?php
2 /**
3 * Test Generated example demonstrating the PledgePayment.update API.
4 *
5 * @return array
6 * API result array
7 */
8 function pledge_payment_update_example() {
9 $params = [
10 'id' => 1,
11 'status_id' => 1,
12 ];
13
14 try{
15 $result = civicrm_api3('PledgePayment', 'update', $params);
16 }
17 catch (CiviCRM_API3_Exception $e) {
18 // Handle error here.
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return [
23 'is_error' => 1,
24 'error_message' => $errorMessage,
25 'error_code' => $errorCode,
26 'error_data' => $errorData,
27 ];
28 }
29
30 return $result;
31 }
32
33 /**
34 * Function returns array of result expected from previous function.
35 *
36 * @return array
37 * API result array
38 */
39 function pledge_payment_update_expectedresult() {
40
41 $expectedResult = [
42 'is_error' => 0,
43 'version' => 3,
44 'count' => 1,
45 'id' => 1,
46 'values' => [
47 '1' => [
48 'id' => '1',
49 'pledge_id' => '1',
50 'contribution_id' => '1',
51 'scheduled_amount' => '20.00',
52 'actual_amount' => '20.00',
53 'currency' => 'USD',
54 'scheduled_date' => '20130728085413',
55 'reminder_date' => '',
56 'reminder_count' => 0,
57 'status_id' => '1',
58 ],
59 ],
60 ];
61
62 return $expectedResult;
63 }
64
65 /*
66 * This example has been generated from the API test suite.
67 * The test that created it is called "testUpdatePledgePayment"
68 * and can be found at:
69 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
70 *
71 * You can see the outcome of the API tests at
72 * https://test.civicrm.org/job/CiviCRM-master-git/
73 *
74 * To Learn about the API read
75 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
76 *
77 * Browse the api on your own site with the api explorer
78 * http://MYSITE.ORG/path/to/civicrm/api
79 *
80 * Read more about testing here
81 * http://wiki.civicrm.org/confluence/display/CRM/Testing
82 *
83 * API Standards documentation:
84 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
85 */