3 * Test Generated example of using contribution get API
6 function contribution_get_example(){
8 'contribution_id' => 1,
12 $result = civicrm_api3('contribution', 'get', $params);
14 catch (CiviCRM_API3_Exception
$e) {
16 $errorMessage = $e->getMessage();
17 $errorCode = $e->getErrorCode();
18 $errorData = $e->getExtraParams();
19 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
26 * Function returns array of result expected from previous function
28 function contribution_get_expectedresult(){
30 $expectedResult = array(
38 'contact_type' => 'Individual',
39 'contact_sub_type' => '',
40 'sort_name' => 'Anderson, Anthony',
41 'display_name' => 'Mr. Anthony Anderson II',
42 'contribution_id' => '1',
44 'receive_date' => '2010-01-20 00:00:00',
45 'non_deductible_amount' => '10.00',
46 'total_amount' => '100.00',
47 'fee_amount' => '5.00',
48 'net_amount' => '95.00',
50 'invoice_id' => '78910',
52 'cancel_reason' => '',
54 'thankyou_date' => '',
55 'contribution_source' => 'SSF',
59 'contribution_status_id' => '1',
61 'contribution_campaign_id' => '',
62 'financial_type_id' => '1',
63 'financial_type' => 'Donation',
64 'instrument_id' => '',
65 'payment_instrument' => '',
69 'contribution_product_id' => '',
70 'product_option' => '',
71 'fulfilled_date' => '',
72 'contribution_start_date' => '',
73 'contribution_end_date' => '',
74 'contribution_recur_id' => '',
75 'financial_account_id' => '1',
76 'accounting_code' => '4200',
77 'contribution_note' => '',
78 'contribution_batch' => '',
79 'contribution_status' => 'Completed',
80 'contribution_payment_instrument' => '',
81 'contribution_check_number' => '',
83 'contribution_type_id' => '1',
88 return $expectedResult;
93 * This example has been generated from the API test suite. The test that created it is called
95 * testGetContributionLegacyBehaviour and can be found in
96 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContributionTest.php
98 * You can see the outcome of the API tests at
99 * http://tests.dev.civicrm.org/trunk/results-api_v3
101 * To Learn about the API read
102 * http://book.civicrm.org/developer/current/techniques/api/
104 * and review the wiki at
105 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
107 * Read more about testing here
108 * http://wiki.civicrm.org/confluence/display/CRM/Testing
110 * API Standards documentation:
111 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards