Merge pull request #3223 from lcdservices/CRM-14672
[civicrm-core.git] / api / v3 / examples / PaymentProcessorType / Create.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using payment_processor_type create API
4 * *
6a488035
TO
5 */
6function 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 16try{
17 $result = civicrm_api3('payment_processor_type', 'create', $params);
18}
19catch (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 27return $result;
6a488035
TO
28}
29
fb32de45 30/**
6a488035
TO
31 * Function returns array of result expected from previous function
32 */
33function 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
69d79249 76* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php
6a488035
TO
77*
78* You can see the outcome of the API tests at
69d79249 79* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
80*
81* To Learn about the API read
69d79249 82* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 83*
69d79249
E
84* Browse the api on your own site with the api explorer
85* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
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
b259a4ab 92*/