Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using payment_processor_type create API | |
4 | * * | |
6a488035 TO |
5 | */ |
6 | function payment_processor_type_create_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 TO |
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 | ||
fb32de45 | 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 | } | |
6a488035 | 26 | |
fb32de45 | 27 | return $result; |
6a488035 TO |
28 | } |
29 | ||
fb32de45 | 30 | /** |
6a488035 TO |
31 | * Function returns array of result expected from previous function |
32 | */ | |
33 | function payment_processor_type_create_expectedresult(){ | |
34 | ||
53ca8fd7 | 35 | $expectedResult = array( |
6a488035 TO |
36 | 'is_error' => 0, |
37 | 'version' => 3, | |
38 | 'count' => 1, | |
39 | 'id' => 1, | |
53ca8fd7 | 40 | 'values' => array( |
41 | '0' => array( | |
6a488035 TO |
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 | ||
fb32de45 | 68 | return $expectedResult; |
6a488035 TO |
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 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/PaymentProcessorTypeTest.php | |
77 | * | |
78 | * You can see the outcome of the API tests at | |
79 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
80 | * | |
81 | * To Learn about the API read | |
82 | * http://book.civicrm.org/developer/current/techniques/api/ | |
83 | * | |
84 | * and review the wiki at | |
85 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
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 | */ |