Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function contribution_recur_create_example(){ | |
edb0d67a | 7 | $params = array( |
6a488035 TO |
8 | 'version' => 3, |
9 | 'contact_id' => 3, | |
10 | 'installments' => '12', | |
11 | 'frequency_interval' => '1', | |
12 | 'amount' => '500', | |
13 | 'contribution_status_id' => 1, | |
14 | 'start_date' => '2012-01-01 00:00:00', | |
15 | 'currency' => 'USD', | |
16 | 'frequency_unit' => 'day', | |
17 | ); | |
18 | ||
19 | $result = civicrm_api( 'contribution_recur','create',$params ); | |
20 | ||
21 | return $result; | |
22 | } | |
23 | ||
24 | /* | |
25 | * Function returns array of result expected from previous function | |
26 | */ | |
27 | function contribution_recur_create_expectedresult(){ | |
28 | ||
edb0d67a | 29 | $expectedResult = array( |
6a488035 TO |
30 | 'is_error' => 0, |
31 | 'version' => 3, | |
32 | 'count' => 1, | |
33 | 'id' => 1, | |
edb0d67a | 34 | 'values' => array( |
35 | '1' => array( | |
6a488035 TO |
36 | 'id' => '1', |
37 | 'contact_id' => '3', | |
38 | 'amount' => '500', | |
39 | 'currency' => 'USD', | |
40 | 'frequency_unit' => 'day', | |
41 | 'frequency_interval' => '1', | |
42 | 'installments' => '12', | |
43 | 'start_date' => '20120101000000', | |
9da8dc8c | 44 | 'create_date' => '20130713234826', |
6a488035 TO |
45 | 'modified_date' => '2012-11-14 16:02:35', |
46 | 'cancel_date' => '', | |
47 | 'end_date' => '', | |
48 | 'processor_id' => '', | |
49 | 'trxn_id' => '', | |
50 | 'invoice_id' => '', | |
51 | 'contribution_status_id' => '1', | |
52 | 'is_test' => '', | |
53 | 'cycle_day' => '', | |
54 | 'next_sched_contribution' => '', | |
55 | 'failure_count' => '', | |
56 | 'failure_retry_date' => '', | |
57 | 'auto_renew' => '', | |
58 | 'payment_processor_id' => '', | |
59 | 'financial_type_id' => '', | |
60 | 'payment_instrument_id' => '', | |
61 | 'campaign_id' => '', | |
62 | 'is_email_receipt' => '', | |
63 | ), | |
64 | ), | |
65 | ); | |
66 | ||
67 | return $expectedResult ; | |
68 | } | |
69 | ||
70 | ||
71 | /* | |
72 | * This example has been generated from the API test suite. The test that created it is called | |
73 | * | |
74 | * testCreateContributionRecur and can be found in | |
75 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContributionRecurTest.php | |
76 | * | |
77 | * You can see the outcome of the API tests at | |
78 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
79 | * | |
80 | * To Learn about the API read | |
81 | * http://book.civicrm.org/developer/current/techniques/api/ | |
82 | * | |
83 | * and review the wiki at | |
84 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
85 | * | |
86 | * Read more about testing here | |
87 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
88 | * | |
89 | * API Standards documentation: | |
90 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
91 | */ |