Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-04-21-08-12-12
[civicrm-core.git] / api / v3 / examples / PaymentProcessorType / Create.php
1 <?php
2 /**
3 * Test Generated example of using payment_processor_type create API
4 * *
5 */
6 function payment_processor_type_create_example(){
7 $params = array(
8 'sequential' => 1,
9 'name' => 'API_Test_PP',
10 'title' => 'API Test Payment Processor',
11 'class_name' => 'CRM_Core_Payment_APITest',
12 'billing_mode' => 'form',
13 'is_recur' => 0,
14 );
15
16 try{
17 $result = civicrm_api3('payment_processor_type', 'create', $params);
18 }
19 catch (CiviCRM_API3_Exception $e) {
20 // handle error here
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
24 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
25 }
26
27 return $result;
28 }
29
30 /**
31 * Function returns array of result expected from previous function
32 */
33 function payment_processor_type_create_expectedresult(){
34
35 $expectedResult = array(
36 'is_error' => 0,
37 'version' => 3,
38 'count' => 1,
39 'id' => 1,
40 'values' => array(
41 '0' => array(
42 'id' => '1',
43 'name' => 'API_Test_PP',
44 'title' => 'API Test Payment Processor',
45 'description' => '',
46 'is_active' => '1',
47 'is_default' => '',
48 'user_name_label' => '',
49 'password_label' => '',
50 'signature_label' => '',
51 'subject_label' => '',
52 'class_name' => 'CRM_Core_Payment_APITest',
53 'url_site_default' => '',
54 'url_api_default' => '',
55 'url_recur_default' => '',
56 'url_button_default' => '',
57 'url_site_test_default' => '',
58 'url_api_test_default' => '',
59 'url_recur_test_default' => '',
60 'url_button_test_default' => '',
61 'billing_mode' => '1',
62 'is_recur' => 0,
63 'payment_type' => '',
64 ),
65 ),
66 );
67
68 return $expectedResult;
69 }
70
71
72 /*
73 * This example has been generated from the API test suite. The test that created it is called
74 *
75 * testPaymentProcessorTypeCreate and can be found in
76 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php
77 *
78 * You can see the outcome of the API tests at
79 * https://test.civicrm.org/job/CiviCRM-master-git/
80 *
81 * To Learn about the API read
82 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
83 *
84 * Browse the api on your own site with the api explorer
85 * http://MYSITE.ORG/path/to/civicrm/api/explorer
86 *
87 * Read more about testing here
88 * http://wiki.civicrm.org/confluence/display/CRM/Testing
89 *
90 * API Standards documentation:
91 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
92 */