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