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