Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
50fb255d | 2 | /** |
3 | * Test Generated example of using payment_processor_type create API. | |
4 | * | |
50fb255d | 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 | ); | |
6a488035 | 17 | |
50fb255d | 18 | try{ |
19 | $result = civicrm_api3('payment_processor_type', '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 | 'error' => $errorMessage, | |
28 | 'error_code' => $errorCode, | |
29 | 'error_data' => $errorData, | |
30 | ); | |
31 | } | |
32 | ||
33 | return $result; | |
6a488035 TO |
34 | } |
35 | ||
fb32de45 | 36 | /** |
50fb255d | 37 | * Function returns array of result expected from previous function. |
38 | * | |
39 | * @return array | |
40 | * API result array | |
6a488035 | 41 | */ |
50fb255d | 42 | function payment_processor_type_create_expectedresult() { |
6a488035 | 43 | |
53ca8fd7 | 44 | $expectedResult = array( |
50fb255d | 45 | 'is_error' => 0, |
46 | 'version' => 3, | |
47 | 'count' => 1, | |
48 | 'id' => 15, | |
49 | 'values' => array( | |
53ca8fd7 | 50 | '0' => array( |
50fb255d | 51 | 'id' => '15', |
52 | 'name' => 'API_Test_PP', | |
53 | 'title' => 'API Test Payment Processor', | |
54 | 'description' => '', | |
55 | 'is_active' => '1', | |
56 | 'is_default' => '', | |
57 | 'user_name_label' => '', | |
58 | 'password_label' => '', | |
59 | 'signature_label' => '', | |
60 | 'subject_label' => '', | |
61 | 'class_name' => 'CRM_Core_Payment_APITest', | |
62 | 'url_site_default' => '', | |
63 | 'url_api_default' => '', | |
64 | 'url_recur_default' => '', | |
65 | 'url_button_default' => '', | |
66 | 'url_site_test_default' => '', | |
67 | 'url_api_test_default' => '', | |
68 | 'url_recur_test_default' => '', | |
69 | 'url_button_test_default' => '', | |
70 | 'billing_mode' => '1', | |
71 | 'is_recur' => 0, | |
72 | 'payment_type' => '', | |
73 | ), | |
6a488035 | 74 | ), |
50fb255d | 75 | ); |
6a488035 | 76 | |
fb32de45 | 77 | return $expectedResult; |
6a488035 TO |
78 | } |
79 | ||
50fb255d | 80 | /** |
81 | * This example has been generated from the API test suite. | |
82 | * The test that created it is called | |
83 | * testPaymentProcessorTypeCreate | |
84 | * and can be found in | |
69d79249 | 85 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php |
6a488035 TO |
86 | * |
87 | * You can see the outcome of the API tests at | |
69d79249 | 88 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
6a488035 TO |
89 | * |
90 | * To Learn about the API read | |
69d79249 | 91 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
6a488035 | 92 | * |
69d79249 | 93 | * Browse the api on your own site with the api explorer |
41d4d31f | 94 | * http://MYSITE.ORG/path/to/civicrm/api |
6a488035 TO |
95 | * |
96 | * Read more about testing here | |
97 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
98 | * | |
99 | * API Standards documentation: | |
100 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 101 | */ |