updated examples
[civicrm-core.git] / api / v3 / examples / PaymentProcessorCreate.php
CommitLineData
21150aae 1<?php
fb32de45 2/**
3 * Test Generated example of using payment_processor create API
4 * *
21150aae
CW
5 */
6function payment_processor_create_example(){
53ca8fd7 7$params = array(
21150aae
CW
8 'name' => 'API Test PP',
9 'payment_processor_type_id' => 1,
10 'class_name' => 'CRM_Core_Payment_APITest',
11 'is_recur' => 0,
12 'domain_id' => 1,
13);
14
fb32de45 15try{
16 $result = civicrm_api3('payment_processor', 'create', $params);
17}
18catch (CiviCRM_API3_Exception $e) {
19 // handle error here
20 $errorMessage = $e->getMessage();
21 $errorCode = $e->getErrorCode();
22 $errorData = $e->getExtraParams();
23 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
24}
21150aae 25
fb32de45 26return $result;
21150aae
CW
27}
28
fb32de45 29/**
21150aae
CW
30 * Function returns array of result expected from previous function
31 */
32function payment_processor_create_expectedresult(){
33
53ca8fd7 34 $expectedResult = array(
21150aae
CW
35 'is_error' => 0,
36 'version' => 3,
37 'count' => 1,
38 'id' => 1,
53ca8fd7 39 'values' => array(
40 '1' => array(
21150aae
CW
41 'id' => '1',
42 'domain_id' => '1',
43 'name' => 'API Test PP',
44 'description' => '',
45 'payment_processor_type_id' => '1',
46 'is_active' => '',
47 'is_default' => 0,
48 'is_test' => 0,
49 'user_name' => '',
50 'password' => '',
51 'signature' => '',
52 'url_site' => '',
53 'url_api' => '',
54 'url_recur' => '',
55 'url_button' => '',
56 'subject' => '',
57 'class_name' => 'CRM_Core_Payment_APITest',
58 'billing_mode' => '1',
59 'is_recur' => 0,
60 'payment_type' => '1',
61 ),
62 ),
63);
64
fb32de45 65 return $expectedResult;
21150aae
CW
66}
67
68
69/*
70* This example has been generated from the API test suite. The test that created it is called
71*
72* testPaymentProcessorCreate and can be found in
73* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/PaymentProcessorTest.php
74*
75* You can see the outcome of the API tests at
76* http://tests.dev.civicrm.org/trunk/results-api_v3
77*
78* To Learn about the API read
79* http://book.civicrm.org/developer/current/techniques/api/
80*
81* and review the wiki at
82* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
83*
84* Read more about testing here
85* http://wiki.civicrm.org/confluence/display/CRM/Testing
86*
87* API Standards documentation:
88* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 89*/