Remove boilerplate from the top of api example files
[civicrm-core.git] / api / v3 / examples / PaymentProcessorType / Create.php
CommitLineData
6a488035 1<?php
50fb255d 2/**
3 * Test Generated example of using payment_processor_type create API.
4 *
5 *
6 * @return array
7 * API result array
8 */
9function payment_processor_type_create_example() {
10 $params = array(
11 'sequential' => 1,
12 'name' => 'API_Test_PP',
13 'title' => 'API Test Payment Processor',
14 'class_name' => 'CRM_Core_Payment_APITest',
15 'billing_mode' => 'form',
16 'is_recur' => 0,
17 );
6a488035 18
50fb255d 19 try{
20 $result = civicrm_api3('payment_processor_type', 'create', $params);
21 }
22 catch (CiviCRM_API3_Exception $e) {
23 // Handle error here.
24 $errorMessage = $e->getMessage();
25 $errorCode = $e->getErrorCode();
26 $errorData = $e->getExtraParams();
27 return array(
28 'error' => $errorMessage,
29 'error_code' => $errorCode,
30 'error_data' => $errorData,
31 );
32 }
33
34 return $result;
6a488035
TO
35}
36
fb32de45 37/**
50fb255d 38 * Function returns array of result expected from previous function.
39 *
40 * @return array
41 * API result array
6a488035 42 */
50fb255d 43function payment_processor_type_create_expectedresult() {
6a488035 44
53ca8fd7 45 $expectedResult = array(
50fb255d 46 'is_error' => 0,
47 'version' => 3,
48 'count' => 1,
49 'id' => 15,
50 'values' => array(
53ca8fd7 51 '0' => array(
50fb255d 52 'id' => '15',
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 ),
6a488035 75 ),
50fb255d 76 );
6a488035 77
fb32de45 78 return $expectedResult;
6a488035
TO
79}
80
50fb255d 81/**
82* This example has been generated from the API test suite.
83* The test that created it is called
84* testPaymentProcessorTypeCreate
85* and can be found in
69d79249 86* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php
6a488035
TO
87*
88* You can see the outcome of the API tests at
69d79249 89* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
90*
91* To Learn about the API read
69d79249 92* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 93*
69d79249
E
94* Browse the api on your own site with the api explorer
95* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
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
b259a4ab 102*/