Merge pull request #583 from yashodha/CRM-12463
[civicrm-core.git] / api / v3 / examples / PledgeCreate.php
1 <?php
2
3 /*
4
5 */
6 function pledge_create_example(){
7 $params = array(
8 'contact_id' => 11,
9 'pledge_create_date' => '20130204',
10 'start_date' => '20130204',
11 'scheduled_date' => '20130206',
12 'amount' => '100',
13 'pledge_status_id' => '2',
14 'pledge_financial_type_id' => '1',
15 'pledge_original_installment_amount' => 20,
16 'frequency_interval' => 5,
17 'frequency_unit' => 'year',
18 'frequency_day' => 15,
19 'installments' => 5,
20 'sequential' => 1,
21 'version' => 3,
22 );
23
24 $result = civicrm_api( 'pledge','create',$params );
25
26 return $result;
27 }
28
29 /*
30 * Function returns array of result expected from previous function
31 */
32 function pledge_create_expectedresult(){
33
34 $expectedResult = array(
35 'is_error' => 0,
36 'version' => 3,
37 'count' => 1,
38 'id' => 1,
39 'values' => array(
40 '0' => array(
41 'id' => '1',
42 'contact_id' => '11',
43 'financial_type_id' => '1',
44 'contribution_page_id' => '',
45 'amount' => '100',
46 'original_installment_amount' => '20',
47 'currency' => 'USD',
48 'frequency_unit' => 'year',
49 'frequency_interval' => '5',
50 'frequency_day' => '15',
51 'installments' => '5',
52 'start_date' => '20130204000000',
53 'create_date' => '20130204000000',
54 'acknowledge_date' => '',
55 'modified_date' => '2012-11-14 16:02:35',
56 'cancel_date' => '',
57 'end_date' => '',
58 'honor_contact_id' => '',
59 'honor_type_id' => '',
60 'max_reminders' => '',
61 'initial_reminder_day' => '',
62 'additional_reminder_day' => '',
63 'status_id' => '2',
64 'is_test' => '',
65 'campaign_id' => '',
66 ),
67 ),
68 );
69
70 return $expectedResult ;
71 }
72
73
74 /*
75 * This example has been generated from the API test suite. The test that created it is called
76 *
77 * testCreatePledge and can be found in
78 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/PledgeTest.php
79 *
80 * You can see the outcome of the API tests at
81 * http://tests.dev.civicrm.org/trunk/results-api_v3
82 *
83 * To Learn about the API read
84 * http://book.civicrm.org/developer/current/techniques/api/
85 *
86 * and review the wiki at
87 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
88 *
89 * Read more about testing here
90 * http://wiki.civicrm.org/confluence/display/CRM/Testing
91 *
92 * API Standards documentation:
93 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
94 */