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