Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2014-11-14-11-21-50
[civicrm-core.git] / api / v3 / examples / ContributionPage / Get.php
1 <?php
2 /**
3 * Test Generated example of using contribution_page get API
4 * *
5 */
6 function contribution_page_get_example(){
7 $params = array(
8 'amount' => '34567',
9 'currency' => 'NZD',
10 'financial_type_id' => 1,
11 );
12
13 try{
14 $result = civicrm_api3('contribution_page', 'get', $params);
15 }
16 catch (CiviCRM_API3_Exception $e) {
17 // handle error here
18 $errorMessage = $e->getMessage();
19 $errorCode = $e->getErrorCode();
20 $errorData = $e->getExtraParams();
21 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
22 }
23
24 return $result;
25 }
26
27 /**
28 * Function returns array of result expected from previous function
29 */
30 function contribution_page_get_expectedresult(){
31
32 $expectedResult = array(
33 'is_error' => 0,
34 'version' => 3,
35 'count' => 1,
36 'id' => 1,
37 'values' => array(
38 '1' => array(
39 'id' => '1',
40 'title' => 'Test Contribution Page',
41 'financial_type_id' => '1',
42 'is_credit_card_only' => 0,
43 'is_monetary' => '1',
44 'is_recur' => 0,
45 'is_confirm_enabled' => '1',
46 'is_recur_interval' => 0,
47 'is_recur_installments' => 0,
48 'is_pay_later' => '1',
49 'is_partial_payment' => 0,
50 'is_allow_other_amount' => 0,
51 'goal_amount' => '34567.00',
52 'is_for_organization' => 0,
53 'is_email_receipt' => 0,
54 'is_active' => '1',
55 'amount_block_is_active' => '1',
56 'currency' => 'NZD',
57 'is_share' => '1',
58 'is_billing_required' => 0,
59 ),
60 ),
61 );
62
63 return $expectedResult;
64 }
65
66
67 /*
68 * This example has been generated from the API test suite. The test that created it is called
69 *
70 * testGetContributionPageByAmount and can be found in
71 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
72 *
73 * You can see the outcome of the API tests at
74 * https://test.civicrm.org/job/CiviCRM-master-git/
75 *
76 * To Learn about the API read
77 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
78 *
79 * Browse the api on your own site with the api explorer
80 * http://MYSITE.ORG/path/to/civicrm/api/explorer
81 *
82 * Read more about testing here
83 * http://wiki.civicrm.org/confluence/display/CRM/Testing
84 *
85 * API Standards documentation:
86 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
87 */