3 * Test Generated example of using contribution get API.
9 function contribution_get_example() {
11 'contribution_id' => 1,
15 $result = civicrm_api3('contribution', 'get', $params);
17 catch (CiviCRM_API3_Exception
$e) {
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
23 'error' => $errorMessage,
24 'error_code' => $errorCode,
25 'error_data' => $errorData,
33 * Function returns array of result expected from previous function.
38 function contribution_get_expectedresult() {
40 $expectedResult = array(
48 'contact_type' => 'Individual',
49 'contact_sub_type' => '',
50 'sort_name' => 'Anderson, Anthony',
51 'display_name' => 'Mr. Anthony Anderson II',
52 'contribution_id' => '1',
54 'receive_date' => '2010-01-20 00:00:00',
55 'non_deductible_amount' => '10.00',
56 'total_amount' => '100.00',
57 'fee_amount' => '5.00',
58 'net_amount' => '95.00',
60 'invoice_id' => '78910',
62 'cancel_reason' => '',
64 'thankyou_date' => '',
65 'contribution_source' => 'SSF',
69 'contribution_status_id' => '1',
71 'contribution_campaign_id' => '',
72 'financial_type_id' => '1',
73 'financial_type' => 'Donation',
74 'instrument_id' => '89',
75 'payment_instrument' => 'Check',
79 'contribution_product_id' => '',
80 'product_option' => '',
81 'fulfilled_date' => '',
82 'contribution_start_date' => '',
83 'contribution_end_date' => '',
84 'contribution_recur_id' => '',
85 'financial_account_id' => '1',
86 'accounting_code' => '4200',
87 'contribution_note' => '',
88 'contribution_batch' => '',
89 'contribution_status' => 'Completed',
90 'contribution_payment_instrument' => 'Check',
91 'contribution_check_number' => '',
93 'contribution_type_id' => '1',
98 return $expectedResult;
102 * This example has been generated from the API test suite.
103 * The test that created it is called
104 * testGetContributionLegacyBehaviour
105 * and can be found in
106 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
108 * You can see the outcome of the API tests at
109 * https://test.civicrm.org/job/CiviCRM-master-git/
111 * To Learn about the API read
112 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
114 * Browse the api on your own site with the api explorer
115 * http://MYSITE.ORG/path/to/civicrm/api
117 * Read more about testing here
118 * http://wiki.civicrm.org/confluence/display/CRM/Testing
120 * API Standards documentation:
121 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards