3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * Test APIv3 civicrm_contribute_* functions
31 * @package CiviCRM_APIv3
32 * @subpackage API_Contribution
35 class api_v3_PaymentTest
extends CiviUnitTestCase
{
37 protected $_individualId;
38 protected $_financialTypeId = 1;
39 protected $_apiversion;
45 public function setUp() {
48 $this->_apiversion
= 3;
49 $this->_individualId
= $this->individualCreate();
50 CRM_Core_Config
::singleton()->userPermissionClass
->permissions
= array();
54 * Clean up after each test.
56 public function tearDown() {
57 $this->quickCleanUpFinancialEntities();
58 $this->quickCleanup(array('civicrm_uf_match'));
59 unset(CRM_Core_Config
::singleton()->userPermissionClass
->permissions
);
63 * Test Get Payment api.
65 public function testGetPayment() {
67 'contact_id' => $this->_individualId
,
68 'receive_date' => '2010-01-20',
69 'total_amount' => 100.00,
70 'financial_type_id' => $this->_financialTypeId
,
72 'contribution_status_id' => 1,
74 $contribution = $this->callAPISuccess('contribution', 'create', $p);
77 'contribution_id' => $contribution['id'],
78 'check_permissions' => TRUE,
80 CRM_Core_Config
::singleton()->userPermissionClass
->permissions
= array('access CiviCRM', 'administer CiviCRM');
81 $payment = $this->callAPIFailure('payment', 'get', $params, 'API permission check failed for Payment/get call; insufficient permission: require access CiviCRM and access CiviContribute');
83 array_push(CRM_Core_Config
::singleton()->userPermissionClass
->permissions
, 'access CiviContribute');
84 $payment = $this->callAPISuccess('payment', 'get', $params);
86 $payment = $this->callAPIAndDocument('payment', 'get', $params, __FUNCTION__
, __FILE__
);
87 $this->assertEquals(1, $payment['count']);
89 $expectedResult = array(
90 $contribution['id'] => array(
91 'total_amount' => 100,
93 'trxn_date' => '2010-01-20 00:00:00',
94 'contribution_id' => $contribution['id'],
98 $this->checkPaymentResult($payment, $expectedResult);
99 $this->callAPISuccess('Contribution', 'Delete', array(
100 'id' => $contribution['id'],
105 * Test email receipt for partial payment.
107 public function testPaymentEmailReceipt() {
108 $mut = new CiviMailUtils($this);
109 list($lineItems, $contribution) = $this->createParticipantWithContribution();
110 $event = $this->callAPISuccess('Event', 'get', []);
111 $this->addLocationToEvent($event['id']);
113 'contribution_id' => $contribution['id'],
114 'total_amount' => 50,
115 'check_number' => '345',
116 'trxn_date' => '2018-08-13 17:57:56',
118 $payment = $this->callAPISuccess('payment', 'create', $params);
119 $this->checkPaymentResult($payment, [
121 'from_financial_account_id' => 7,
122 'to_financial_account_id' => 6,
123 'total_amount' => 50,
129 $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
130 $mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet']);
131 $mut->checkMailLog(array(
133 'Total Fees: $ 300.00',
134 'This Payment Amount: $ 50.00',
135 //150 was paid in the 1st payment.
136 'Balance Owed: $ 100.00',
137 'Event Information and Location',
140 'Transaction Date: August 13th, 2018 5:57 PM',
145 $mut->clearMessages();
149 * Test email receipt for partial payment.
151 public function testPaymentEmailReceiptFullyPaid() {
152 $mut = new CiviMailUtils($this);
153 list($lineItems, $contribution) = $this->createParticipantWithContribution();
156 'contribution_id' => $contribution['id'],
157 'total_amount' => 150,
159 $payment = $this->callAPISuccess('payment', 'create', $params);
161 $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
162 $mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet']);
163 $mut->checkMailLog(array(
165 'A payment has been received.',
166 'Total Fees: $ 300.00',
167 'This Payment Amount: $ 150.00',
168 'Balance Owed: $ 0.00',
169 'Thank you for completing payment.',
172 $mut->clearMessages();
176 * Test email receipt for partial payment.
178 * @dataProvider getThousandSeparators
180 * @param string $thousandSeparator
182 public function testRefundEmailReceipt($thousandSeparator) {
183 $this->setCurrencySeparators($thousandSeparator);
184 $decimalSeparator = ($thousandSeparator === ',' ?
'.' : ',');
185 $mut = new CiviMailUtils($this);
186 list($lineItems, $contribution) = $this->createParticipantWithContribution();
187 $this->callAPISuccess('payment', 'create', [
188 'contribution_id' => $contribution['id'],
189 'total_amount' => 50,
190 'check_number' => '345',
191 'trxn_date' => '2018-08-13 17:57:56',
194 $payment = $this->callAPISuccess('payment', 'create', [
195 'contribution_id' => $contribution['id'],
196 'total_amount' => -30,
197 'trxn_date' => '2018-11-13 12:01:56',
198 'sequential' => TRUE,
202 'from_financial_account_id' => 7,
203 'to_financial_account_id' => 6,
204 'total_amount' => -30,
205 'status_id' => CRM_Core_PseudoConstant
::getKey('CRM_Core_BAO_FinancialTrxn', 'status_id', 'Refunded'),
208 foreach ($expected as $key => $value) {
209 $this->assertEquals($expected[$key], $payment[$key], 'mismatch on key ' . $key);
212 $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
213 $mut->assertSubjects(['Refund Notification - Annual CiviCRM meet']);
214 $mut->checkMailLog(array(
216 'A refund has been issued based on changes in your registration selections.',
217 'Total Fees: $ 300' . $decimalSeparator . '00',
218 'Refund Amount: $ -30' . $decimalSeparator . '00',
219 'Event Information and Location',
221 'Transaction Date: November 13th, 2018 12:01 PM',
222 'You Paid: $ 170' . $decimalSeparator . '00',
225 $mut->clearMessages();
229 * Test create payment api with no line item in params
231 public function testCreatePaymentNoLineItems() {
232 list($lineItems, $contribution) = $this->createParticipantWithContribution();
234 //Create partial payment
236 'contribution_id' => $contribution['id'],
237 'total_amount' => 50,
239 $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__
, __FILE__
);
240 $expectedResult = array(
241 $payment['id'] => array(
242 'from_financial_account_id' => 7,
243 'to_financial_account_id' => 6,
244 'total_amount' => 50,
249 $this->checkPaymentResult($payment, $expectedResult);
251 // Check entity financial trxn created properly
253 'entity_id' => $contribution['id'],
254 'entity_table' => 'civicrm_contribution',
255 'financial_trxn_id' => $payment['id'],
258 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
260 $this->assertEquals($eft['values'][$eft['id']]['amount'], 50);
263 'entity_table' => 'civicrm_financial_item',
264 'financial_trxn_id' => $payment['id'],
266 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
267 $amounts = array(33.33, 16.67);
268 foreach ($eft['values'] as $value) {
269 $this->assertEquals($value['amount'], array_pop($amounts));
272 // Now create payment to complete total amount of contribution
274 'contribution_id' => $contribution['id'],
275 'total_amount' => 100,
277 $payment = $this->callAPISuccess('payment', 'create', $params);
278 $expectedResult = array(
279 $payment['id'] => array(
280 'from_financial_account_id' => 7,
281 'to_financial_account_id' => 6,
282 'total_amount' => 100,
287 $this->checkPaymentResult($payment, $expectedResult);
289 'entity_table' => 'civicrm_financial_item',
290 'financial_trxn_id' => $payment['id'],
292 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
293 $amounts = array(66.67, 33.33);
294 foreach ($eft['values'] as $value) {
295 $this->assertEquals($value['amount'], array_pop($amounts));
297 // Check contribution for completed status
298 $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id']));
300 $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Completed');
301 $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 300.00);
302 $paymentParticipant = array(
303 'contribution_id' => $contribution['id'],
305 $participantPayment = $this->callAPISuccess('ParticipantPayment', 'getsingle', $paymentParticipant);
306 $participant = $this->callAPISuccess('participant', 'get', array('id' => $participantPayment['participant_id']));
307 $this->assertEquals($participant['values'][$participant['id']]['participant_status'], 'Registered');
308 $this->callAPISuccess('Contribution', 'Delete', array(
309 'id' => $contribution['id'],
314 * Function to assert db values
316 public function checkPaymentResult($payment, $expectedResult) {
317 foreach ($expectedResult[$payment['id']] as $key => $value) {
318 $this->assertEquals($payment['values'][$payment['id']][$key], $value, 'mismatch on ' . $key);
323 * Test create payment api with line item in params
325 public function testCreatePaymentLineItems() {
326 list($lineItems, $contribution) = $this->createParticipantWithContribution();
327 $lineItems = $this->callAPISuccess('LineItem', 'get', array('contribution_id' => $contribution['id']));
329 //Create partial payment by passing line item array is params
331 'contribution_id' => $contribution['id'],
332 'total_amount' => 50,
334 $amounts = array(40, 10);
335 foreach ($lineItems['values'] as $id => $ignore) {
336 $params['line_item'][] = array($id => array_pop($amounts));
338 $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__
, __FILE__
, 'Payment with line item', 'CreatePaymentWithLineItems');
339 $expectedResult = array(
340 $payment['id'] => array(
341 'from_financial_account_id' => 7,
342 'to_financial_account_id' => 6,
343 'total_amount' => 50,
348 $this->checkPaymentResult($payment, $expectedResult);
350 // Check entity financial trxn created properly
352 'entity_id' => $contribution['id'],
353 'entity_table' => 'civicrm_contribution',
354 'financial_trxn_id' => $payment['id'],
357 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
359 $this->assertEquals($eft['values'][$eft['id']]['amount'], 50);
362 'entity_table' => 'civicrm_financial_item',
363 'financial_trxn_id' => $payment['id'],
365 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
366 $amounts = array(40, 10);
367 foreach ($eft['values'] as $value) {
368 $this->assertEquals($value['amount'], array_pop($amounts));
371 // Now create payment to complete total amount of contribution
373 'contribution_id' => $contribution['id'],
374 'total_amount' => 100,
376 $amounts = array(80, 20);
377 foreach ($lineItems['values'] as $id => $ignore) {
378 $params['line_item'][] = array($id => array_pop($amounts));
380 $payment = $this->callAPISuccess('payment', 'create', $params);
381 $expectedResult = array(
382 $payment['id'] => array(
383 'from_financial_account_id' => 7,
384 'to_financial_account_id' => 6,
385 'total_amount' => 100,
390 $this->checkPaymentResult($payment, $expectedResult);
392 'entity_table' => 'civicrm_financial_item',
393 'financial_trxn_id' => $payment['id'],
395 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
396 $amounts = array(80, 20);
397 foreach ($eft['values'] as $value) {
398 $this->assertEquals($value['amount'], array_pop($amounts));
400 // Check contribution for completed status
401 $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id']));
403 $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Completed');
404 $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 300.00);
405 $paymentParticipant = array(
406 'contribution_id' => $contribution['id'],
408 $participantPayment = $this->callAPISuccess('ParticipantPayment', 'getsingle', $paymentParticipant);
409 $participant = $this->callAPISuccess('participant', 'get', array('id' => $participantPayment['participant_id']));
410 $this->assertEquals($participant['values'][$participant['id']]['participant_status'], 'Registered');
411 $this->callAPISuccess('Contribution', 'Delete', array(
412 'id' => $contribution['id'],
417 * Test cancel payment api
419 public function testCancelPayment() {
420 CRM_Core_Config
::singleton()->userPermissionClass
->permissions
= array('administer CiviCRM', 'access CiviContribute');
421 list($lineItems, $contribution) = $this->createParticipantWithContribution();
424 'contribution_id' => $contribution['id'],
427 $payment = $this->callAPISuccess('payment', 'get', $params);
428 $this->assertEquals(1, $payment['count']);
430 $cancelParams = array(
431 'id' => $payment['id'],
432 'check_permissions' => TRUE,
434 $payment = $this->callAPIFailure('payment', 'cancel', $cancelParams, 'API permission check failed for Payment/cancel call; insufficient permission: require access CiviCRM and access CiviContribute and edit contributions');
436 array_push(CRM_Core_Config
::singleton()->userPermissionClass
->permissions
, 'access CiviCRM', 'edit contributions');
438 $this->callAPIAndDocument('payment', 'cancel', $cancelParams, __FUNCTION__
, __FILE__
);
440 $payment = $this->callAPISuccess('payment', 'get', $params);
441 $this->assertEquals(2, $payment['count']);
442 $amounts = array(-150.00, 150.00);
443 foreach ($payment['values'] as $value) {
444 $this->assertEquals($value['total_amount'], array_pop($amounts), 'Mismatch total amount');
447 $this->callAPISuccess('Contribution', 'Delete', array(
448 'id' => $contribution['id'],
453 * Test delete payment api
455 public function testDeletePayment() {
456 CRM_Core_Config
::singleton()->userPermissionClass
->permissions
= array('administer CiviCRM', 'access CiviContribute');
457 list($lineItems, $contribution) = $this->createParticipantWithContribution();
460 'contribution_id' => $contribution['id'],
463 $payment = $this->callAPISuccess('payment', 'get', $params);
464 $this->assertEquals(1, $payment['count']);
466 $deleteParams = array(
467 'id' => $payment['id'],
468 'check_permissions' => TRUE,
470 $payment = $this->callAPIFailure('payment', 'delete', $deleteParams, 'API permission check failed for Payment/delete call; insufficient permission: require access CiviCRM and access CiviContribute and delete in CiviContribute');
472 array_push(CRM_Core_Config
::singleton()->userPermissionClass
->permissions
, 'access CiviCRM', 'delete in CiviContribute');
473 $this->callAPIAndDocument('payment', 'delete', $deleteParams, __FUNCTION__
, __FILE__
);
475 $payment = $this->callAPISuccess('payment', 'get', $params);
476 $this->assertEquals(0, $payment['count']);
478 $this->callAPISuccess('Contribution', 'Delete', array(
479 'id' => $contribution['id'],
484 * Test update payment api
486 public function testUpdatePayment() {
487 CRM_Core_Config
::singleton()->userPermissionClass
->permissions
= array('administer CiviCRM', 'access CiviContribute', 'edit contributions');
488 list($lineItems, $contribution) = $this->createParticipantWithContribution();
490 //Create partial payment by passing line item array is params
492 'contribution_id' => $contribution['id'],
493 'total_amount' => 50,
496 $payment = $this->callAPISuccess('payment', 'create', $params);
497 $expectedResult = array(
498 $payment['id'] => array(
499 'from_financial_account_id' => 7,
500 'to_financial_account_id' => 6,
501 'total_amount' => 50,
506 $this->checkPaymentResult($payment, $expectedResult);
509 'entity_table' => 'civicrm_financial_item',
510 'financial_trxn_id' => $payment['id'],
512 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
513 $amounts = array(33.33, 16.67);
514 foreach ($eft['values'] as $value) {
515 $this->assertEquals($value['amount'], array_pop($amounts));
517 CRM_Core_Config
::singleton()->userPermissionClass
->permissions
= array('administer CiviCRM', 'access CiviContribute');
519 // update the amount for payment
521 'contribution_id' => $contribution['id'],
522 'total_amount' => 100,
523 'id' => $payment['id'],
524 'check_permissions' => TRUE,
526 $payment = $this->callAPIFailure('payment', 'create', $params, 'API permission check failed for Payment/create call; insufficient permission: require access CiviCRM and access CiviContribute and edit contributions');
528 array_push(CRM_Core_Config
::singleton()->userPermissionClass
->permissions
, 'access CiviCRM', 'edit contributions');
529 $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__
, __FILE__
, 'Update Payment', 'UpdatePayment');
531 // Check for proportional cancelled payment against lineitems.
533 'entity_table' => 'civicrm_financial_item',
534 'financial_trxn_id' => $payment['id'] - 1,
537 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $minParams);
538 $amounts = array(-33.33, -16.67);
540 foreach ($eft['values'] as $value) {
541 $this->assertEquals($value['amount'], array_pop($amounts));
544 // Check for proportional updated payment against lineitems.
546 'entity_table' => 'civicrm_financial_item',
547 'financial_trxn_id' => $payment['id'],
549 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
550 $amounts = array(66.67, 33.33);
551 foreach ($eft['values'] as $value) {
552 $this->assertEquals($value['amount'], array_pop($amounts));
556 'contribution_id' => $contribution['id'],
558 $payment = $this->callAPISuccess('payment', 'get', $params);
559 $amounts = array(100.00, -50.00, 50.00, 150.00);
560 foreach ($payment['values'] as $value) {
561 $amount = array_pop($amounts);
562 $this->assertEquals($value['total_amount'], $amount, 'Mismatch total amount');
564 // Check entity financial trxn created properly
566 'entity_id' => $contribution['id'],
567 'entity_table' => 'civicrm_contribution',
568 'financial_trxn_id' => $value['id'],
570 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
571 $this->assertEquals($eft['values'][$eft['id']]['amount'], $amount);
574 $this->callAPISuccess('Contribution', 'Delete', array(
575 'id' => $contribution['id'],
580 * Test create payment api for paylater contribution
582 public function testCreatePaymentPayLater() {
583 $this->createLoggedInUser();
584 $contributionParams = array(
585 'total_amount' => 100,
587 'contact_id' => $this->_individualId
,
588 'financial_type_id' => 1,
589 'contribution_status_id' => 2,
592 $contribution = $this->callAPISuccess('Contribution', 'create', $contributionParams);
593 //add payment for pay later transaction
595 'contribution_id' => $contribution['id'],
596 'total_amount' => 100,
598 $payment = $this->callAPISuccess('Payment', 'create', $params);
599 $expectedResult = array(
600 $payment['id'] => array(
601 'from_financial_account_id' => 7,
602 'to_financial_account_id' => 6,
603 'total_amount' => 100,
608 $this->checkPaymentResult($payment, $expectedResult);
609 // Check entity financial trxn created properly
611 'entity_id' => $contribution['id'],
612 'entity_table' => 'civicrm_contribution',
613 'financial_trxn_id' => $payment['id'],
615 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
616 $this->assertEquals($eft['values'][$eft['id']]['amount'], 100);
618 'entity_table' => 'civicrm_financial_item',
619 'financial_trxn_id' => $payment['id'],
621 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
622 $this->assertEquals($eft['values'][$eft['id']]['amount'], 100);
623 // Check contribution for completed status
624 $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id']));
625 $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Completed');
626 $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
627 $this->callAPISuccess('Contribution', 'Delete', array(
628 'id' => $contribution['id'],
633 * Test create payment api for paylater contribution with partial payment.
635 public function testCreatePaymentPayLaterPartialPayment() {
636 $this->createLoggedInUser();
637 $contributionParams = array(
638 'total_amount' => 100,
640 'contact_id' => $this->_individualId
,
641 'financial_type_id' => 1,
642 'contribution_status_id' => 2,
645 $contribution = $this->callAPISuccess('Contribution', 'create', $contributionParams);
646 //Create partial payment
648 'contribution_id' => $contribution['id'],
649 'total_amount' => 60,
651 $payment = $this->callAPISuccess('Payment', 'create', $params);
652 $expectedResult = array(
653 $payment['id'] => array(
654 'total_amount' => 60,
659 $this->checkPaymentResult($payment, $expectedResult);
660 // Check entity financial trxn created properly
662 'entity_id' => $contribution['id'],
663 'entity_table' => 'civicrm_contribution',
664 'financial_trxn_id' => $payment['id'],
666 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
667 $this->assertEquals($eft['values'][$eft['id']]['amount'], 60);
669 'entity_table' => 'civicrm_financial_item',
670 'financial_trxn_id' => $payment['id'],
672 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
673 $this->assertEquals($eft['values'][$eft['id']]['amount'], 60);
674 $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id']));
675 $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Partially paid');
676 $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
677 //Create full payment
679 'contribution_id' => $contribution['id'],
680 'total_amount' => 40,
682 $payment = $this->callAPISuccess('Payment', 'create', $params);
683 $expectedResult = array(
684 $payment['id'] => array(
685 'from_financial_account_id' => 7,
686 'to_financial_account_id' => 6,
687 'total_amount' => 40,
692 $this->checkPaymentResult($payment, $expectedResult);
693 // Check entity financial trxn created properly
695 'entity_id' => $contribution['id'],
696 'entity_table' => 'civicrm_contribution',
697 'financial_trxn_id' => $payment['id'],
699 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
700 $this->assertEquals($eft['values'][$eft['id']]['amount'], 40);
702 'entity_table' => 'civicrm_financial_item',
703 'financial_trxn_id' => $payment['id'],
705 $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $params);
706 $this->assertEquals($eft['values'][$eft['id']]['amount'], 40);
707 // Check contribution for completed status
708 $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id']));
709 $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Completed');
710 $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
711 $this->callAPISuccess('Contribution', 'Delete', array(
712 'id' => $contribution['id'],
717 * Add a location to our event.
719 * @param int $eventID
721 protected function addLocationToEvent($eventID) {
723 'name' => 'event place',
724 'street_address' => 'streety street',
725 'location_type_id' => 1,
728 // api requires contact_id - perhaps incorrectly but use add to get past that.
729 $address = CRM_Core_BAO_Address
::add($addressParams);
731 $location = $this->callAPISuccess('LocBlock', 'create', ['address_id' => $address->id
]);
732 $this->callAPISuccess('Event', 'create', [
734 'loc_block_id' => $location['id'],
735 'is_show_location' => TRUE,