Merge pull request #1238 from sfe-ev/CRM-12995_amend
[civicrm-core.git] / api / v3 / examples / ContributionGet.php
1 <?php
2
3 /*
4
5 */
6 function contribution_get_example(){
7 $params = array(
8 'contribution_id' => 1,
9 'version' => 3,
10 'debug' => 0,
11 );
12
13 $result = civicrm_api( 'contribution','get',$params );
14
15 return $result;
16 }
17
18 /*
19 * Function returns array of result expected from previous function
20 */
21 function contribution_get_expectedresult(){
22
23 $expectedResult = array(
24 'is_error' => 0,
25 'version' => 3,
26 'count' => 1,
27 'id' => 1,
28 'values' => array(
29 '1' => array(
30 'contact_id' => '1',
31 'contact_type' => 'Individual',
32 'contact_sub_type' => '',
33 'sort_name' => 'Anderson, Anthony',
34 'display_name' => 'Mr. Anthony Anderson II',
35 'contribution_id' => '1',
36 'currency' => 'USD',
37 'receive_date' => '2010-01-20 00:00:00',
38 'non_deductible_amount' => '10.00',
39 'total_amount' => '100.00',
40 'fee_amount' => '5.00',
41 'net_amount' => '95.00',
42 'trxn_id' => '23456',
43 'invoice_id' => '78910',
44 'cancel_date' => '',
45 'cancel_reason' => '',
46 'receipt_date' => '',
47 'thankyou_date' => '',
48 'contribution_source' => 'SSF',
49 'amount_level' => '',
50 'is_test' => 0,
51 'is_pay_later' => 0,
52 'contribution_status_id' => '1',
53 'check_number' => '',
54 'contribution_campaign_id' => '',
55 'financial_type_id' => '1',
56 'financial_type' => 'Donation',
57 'instrument_id' => '',
58 'payment_instrument' => '',
59 'product_id' => '',
60 'product_name' => '',
61 'sku' => '',
62 'contribution_product_id' => '',
63 'product_option' => '',
64 'fulfilled_date' => '',
65 'contribution_start_date' => '',
66 'contribution_end_date' => '',
67 'contribution_recur_id' => '',
68 'financial_account_id' => '1',
69 'accounting_code' => '4200',
70 'contribution_note' => '',
71 'contribution_batch' => '',
72 'contribution_status' => 'Completed',
73 'contribution_payment_instrument' => '',
74 'contribution_check_number' => '',
75 'id' => '1',
76 'contribution_type_id' => '1',
77 ),
78 ),
79 );
80
81 return $expectedResult ;
82 }
83
84
85 /*
86 * This example has been generated from the API test suite. The test that created it is called
87 *
88 * testGetContributionLegacyBehaviour and can be found in
89 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContributionTest.php
90 *
91 * You can see the outcome of the API tests at
92 * http://tests.dev.civicrm.org/trunk/results-api_v3
93 *
94 * To Learn about the API read
95 * http://book.civicrm.org/developer/current/techniques/api/
96 *
97 * and review the wiki at
98 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
99 *
100 * Read more about testing here
101 * http://wiki.civicrm.org/confluence/display/CRM/Testing
102 *
103 * API Standards documentation:
104 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
105 */