Ian province abbreviation patch - issue 724
[civicrm-core.git] / api / v3 / examples / ContributionPage / Submit.php
... / ...
CommitLineData
1<?php
2/**
3 * Test Generated example demonstrating the ContributionPage.submit API.
4 *
5 * submit contribution page
6 *
7 * @return array
8 * API result array
9 */
10function contribution_page_submit_example() {
11 $params = array(
12 'price_3' => '',
13 'id' => 1,
14 'amount' => 10,
15 'billing_first_name' => 'Billy',
16 'billing_middle_name' => 'Goat',
17 'billing_last_name' => 'Gruff',
18 'email' => 'billy@goat.gruff',
19 'selectMembership' => array(
20 '0' => 1,
21 ),
22 'payment_processor_id' => 1,
23 'credit_card_number' => '4111111111111111',
24 'credit_card_type' => 'Visa',
25 'credit_card_exp_date' => array(
26 'M' => 9,
27 'Y' => 2040,
28 ),
29 'cvv2' => 123,
30 'is_recur' => 1,
31 'frequency_interval' => 1,
32 'frequency_unit' => 'month',
33 );
34
35 try{
36 $result = civicrm_api3('ContributionPage', 'submit', $params);
37 }
38 catch (CiviCRM_API3_Exception $e) {
39 // Handle error here.
40 $errorMessage = $e->getMessage();
41 $errorCode = $e->getErrorCode();
42 $errorData = $e->getExtraParams();
43 return array(
44 'error' => $errorMessage,
45 'error_code' => $errorCode,
46 'error_data' => $errorData,
47 );
48 }
49
50 return $result;
51}
52
53/**
54 * Function returns array of result expected from previous function.
55 *
56 * @return array
57 * API result array
58 */
59function contribution_page_submit_expectedresult() {
60
61 $expectedResult = array(
62 'is_error' => 0,
63 'version' => 3,
64 'count' => 0,
65 'values' => '',
66 );
67
68 return $expectedResult;
69}
70
71/*
72* This example has been generated from the API test suite.
73* The test that created it is called "testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed"
74* and can be found at:
75* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
76*
77* You can see the outcome of the API tests at
78* https://test.civicrm.org/job/CiviCRM-master-git/
79*
80* To Learn about the API read
81* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
82*
83* Browse the api on your own site with the api explorer
84* http://MYSITE.ORG/path/to/civicrm/api
85*
86* Read more about testing here
87* http://wiki.civicrm.org/confluence/display/CRM/Testing
88*
89* API Standards documentation:
90* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
91*/