3 * Test Generated example demonstrating the Pledge.create API.
8 function pledge_create_example() {
11 'pledge_create_date' => '20190820',
12 'start_date' => '20190820',
13 'scheduled_date' => '20190822',
15 'pledge_status_id' => '2',
16 'pledge_financial_type_id' => '1',
17 'pledge_original_installment_amount' => 20,
18 'frequency_interval' => 5,
19 'frequency_unit' => 'year',
20 'frequency_day' => 15,
26 $result = civicrm_api3('Pledge', 'create', $params);
28 catch (CiviCRM_API3_Exception
$e) {
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
35 'error_message' => $errorMessage,
36 'error_code' => $errorCode,
37 'error_data' => $errorData,
45 * Function returns array of result expected from previous function.
50 function pledge_create_expectedresult() {
61 'financial_type_id' => '1',
62 'contribution_page_id' => '',
64 'original_installment_amount' => '20',
66 'frequency_unit' => 'year',
67 'frequency_interval' => '5',
68 'frequency_day' => '15',
69 'installments' => '5',
70 'start_date' => '2013-07-29 00:00:00',
71 'create_date' => '20120130621222105',
72 'acknowledge_date' => '',
73 'modified_date' => '',
76 'max_reminders' => '',
77 'initial_reminder_day' => '',
78 'additional_reminder_day' => '',
82 'contribution_type_id' => '1',
87 return $expectedResult;
91 * This example has been generated from the API test suite.
92 * The test that created it is called "testCreatePledge"
93 * and can be found at:
94 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
96 * You can see the outcome of the API tests at
97 * https://test.civicrm.org/job/CiviCRM-Core-Matrix/
99 * To Learn about the API read
100 * https://docs.civicrm.org/dev/en/latest/api/
102 * Browse the API on your own site with the API Explorer. It is in the main
103 * CiviCRM menu, under: Support > Development > API Explorer.
105 * Read more about testing here
106 * https://docs.civicrm.org/dev/en/latest/testing/
108 * API Standards documentation:
109 * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/