3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 require_once 'CiviTest/CiviUnitTestCase.php';
32 * Class CRM_Core_Payment_BaseIPNTest
34 class CRM_Core_Payment_BaseIPNTest
extends CiviUnitTestCase
{
36 protected $_contributionTypeId;
37 protected $_contributionParams;
38 protected $_contactId;
39 protected $_contributionId;
40 protected $_participantId;
43 protected $_processorId;
44 protected $_contributionRecurParams;
45 protected $_paymentProcessor;
48 protected $_membershipId;
52 public $DBResetRequired = FALSE;
54 public function setUp() {
56 $this->input
= $this->ids
= $this->objects
= array();
57 $this->IPN
= new CRM_Core_Payment_AuthorizeNetIPN($this->input
);
59 $this->_contactId
= $this->individualCreate();
60 $this->ids
['contact'] = $this->_contactId
;
61 $this->paymentProcessor
= new CRM_Financial_BAO_PaymentProcessor();
63 $paymentProcessorParams = array(
64 'user_name' => 'user_name',
65 'password' => 'password',
66 'url_recur' => 'url_recur',
67 //@todo - if we used the api then we could pass in 'AuthNet & the api will resolve
68 // (as least it will once the pseudoconstant s in the schema)
69 'payment_processor_type_id' => $this->callAPISuccess('payment_processor_type', 'getvalue', array(
75 $paymentProcessorParams['domain_id'] = 1;
76 $paymentProcessorParams['is_active'] = 1;
77 $paymentProcessorParams['is_test'] = 1;
78 $paymentProcessorParams['billing_mode'] = 1;
79 $paymentProcessorParams['class_name'] = "Payment_AuthorizeNet";
80 $processorEntity = $this->paymentProcessor
->create($paymentProcessorParams);
82 $this->_processorId
= $processorEntity->id
;
83 $this->_contributionTypeId
= 1;
85 $this->_contributionParams
= array(
86 'contact_id' => $this->_contactId
,
88 'financial_type_id' => $this->_contributionTypeId
,
89 'recieve_date' => date('Ymd'),
90 'total_amount' => 150.00,
91 'invoice_id' => 'c8acb91e080ad7bd8a2adc119c192885',
93 'contribution_recur_id' => $this->_recurId
,
95 'contribution_status_id' => 2,
97 $contribution = civicrm_api('contribution', 'create', $this->_contributionParams
);
98 $this->assertAPISuccess($contribution, 'line ' . __LINE__
. ' set-up of contribution ');
99 $this->_contributionId
= $contribution['id'];
101 $contribution = new CRM_Contribute_BAO_Contribution();
102 $contribution->id
= $this->_contributionId
;
103 $contribution->find(TRUE);
104 $this->objects
['contribution'] = $contribution;
107 public function tearDown() {
108 $this->quickCleanUpFinancialEntities();
109 CRM_Member_PseudoConstant
::membershipType(NULL, TRUE);
110 CRM_Member_PseudoConstant
::membershipStatus(NULL, NULL, 'name', TRUE);
114 * Test the LoadObjects function with recurring membership data.
116 public function testLoadMembershipObjects() {
117 $this->_setUpMembershipObjects();
118 $this->_setUpRecurringContribution();
119 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
120 $this->assertFalse(empty($this->objects
['membership']), 'in line ' . __LINE__
);
121 $this->assertArrayHasKey($this->_membershipTypeID
, $this->objects
['membership'], 'in line ' . __LINE__
);
122 $this->assertTrue(is_a($this->objects
['membership'][$this->_membershipTypeID
], 'CRM_Member_BAO_Membership'));
123 $this->assertTrue(is_a($this->objects
['contributionType'], 'CRM_Financial_BAO_FinancialType'));
124 $this->assertFalse(empty($this->objects
['contributionRecur']), __LINE__
);
125 $this->assertFalse(empty($this->objects
['paymentProcessor']), __LINE__
);
129 * Test the LoadObjects function with recurring membership data.
131 public function testLoadMembershipObjectsLoadAll() {
132 $this->_setUpMembershipObjects();
133 $this->_setUpRecurringContribution();
134 unset($this->ids
['membership']);
135 $contribution = new CRM_Contribute_BAO_Contribution();
136 $contribution->id
= $this->_contributionId
;
137 $contribution->find(TRUE);
138 $contribution->loadRelatedObjects($this->input
, $this->ids
, FALSE, TRUE);
139 $this->assertFalse(empty($contribution->_relatedObjects
['membership']), 'in line ' . __LINE__
);
140 $this->assertArrayHasKey($this->_membershipTypeID
, $contribution->_relatedObjects
['membership'], 'in line ' . __LINE__
);
141 $this->assertTrue(is_a($contribution->_relatedObjects
['membership'][$this->_membershipTypeID
], 'CRM_Member_BAO_Membership'));
142 $this->assertTrue(is_a($contribution->_relatedObjects
['contributionType'], 'CRM_Financial_BAO_FinancialType'));
143 $this->assertFalse(empty($contribution->_relatedObjects
['contributionRecur']), __LINE__
);
144 $this->assertFalse(empty($contribution->_relatedObjects
['paymentProcessor']), __LINE__
);
148 * Test the LoadObjects function with recurring membership data.
150 public function testsendMailMembershipObjects() {
151 $this->_setUpMembershipObjects();
153 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
154 $msg = $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, TRUE);
155 $this->assertTrue(is_array($msg), "Message returned as an array in line" . __LINE__
);
156 $this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
157 $this->assertContains('<p>Please print this confirmation for your records.</p>', $msg['html']);
158 $this->assertContains('Membership Type: General', $msg['body']);
162 * Test the LoadObjects function with recurring membership data.
164 public function testsendMailMembershipWithoutLoadObjects() {
165 $this->_setUpMembershipObjects();
167 $msg = $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, TRUE);
168 $this->assertTrue(is_array($msg), "Message returned as an array in line" . __LINE__
);
169 $this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
170 $this->assertContains('<p>Please print this confirmation for your records.</p>', $msg['html']);
171 $this->assertContains('Membership Type: General', $msg['body']);
175 * Test that loadObjects works with participant values.
177 public function testLoadParticipantObjects() {
178 $this->_setUpParticipantObjects();
179 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
180 $this->assertFalse(empty($this->objects
['participant']), 'in line ' . __LINE__
);
181 $this->assertTrue(is_a($this->objects
['participant'], 'CRM_Event_BAO_Participant'));
182 $this->assertTrue(is_a($this->objects
['contributionType'], 'CRM_Financial_BAO_FinancialType'));
183 $this->assertFalse(empty($this->objects
['event']));
184 $this->assertTrue(is_a($this->objects
['event'], 'CRM_Event_BAO_Event'));
185 $this->assertTrue(is_a($this->objects
['contribution'], 'CRM_Contribute_BAO_Contribution'));
186 $this->assertFalse(empty($this->objects
['event']->id
));
190 * Test the LoadObjects function with a participant.
192 public function testComposeMailParticipant() {
193 $this->_setUpParticipantObjects();
194 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
196 $this->assertFalse(empty($this->objects
['event']));
197 $msg = $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, TRUE);
198 $this->assertContains('registration has been received and your status has been updated to Attended.', $msg['body']);
199 $this->assertContains('Annual CiviCRM meet', $msg['html']);
204 public function testComposeMailParticipantObjects() {
205 $this->_setUpParticipantObjects();
207 $msg = $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, TRUE);
208 $this->assertTrue(is_array($msg), "Message returned as an array in line" . __LINE__
);
209 $this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
210 $this->assertContains('<p>Please print this confirmation for your records.</p>', $msg['html']);
211 $this->assertContains('Thank you for your participation', $msg['body']);
215 * Test the LoadObjects function with recurring membership data.
217 public function testsendMailParticipantObjectsCheckLog() {
218 $this->_setUpParticipantObjects();
220 require_once 'CiviTest/CiviMailUtils.php';
221 $mut = new CiviMailUtils($this, TRUE);
222 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
223 $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, FALSE);
224 $mut->checkMailLog(array(
225 'Thank you for your participation',
226 'Annual CiviCRM meet',
227 'Mr. Anthony Anderson II',
234 * Test the LoadObjects function with recurring membership data.
236 public function testsendMailParticipantObjectsNoMail() {
237 $this->_setUpParticipantObjects();
238 $event = new CRM_Event_BAO_Event();
239 $event->id
= $this->_eventId
;
240 $event->is_email_confirm
= FALSE;
243 $tablesToTruncate = array(
244 'civicrm_mailing_spool',
246 $this->quickCleanup($tablesToTruncate, FALSE);
247 require_once 'CiviTest/CiviMailUtils.php';
248 $mut = new CiviMailUtils($this, TRUE);
249 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
250 $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, FALSE);
251 $mut->assertMailLogEmpty('no mail should have been send as event set to no confirm');
256 * Test that loadObjects works with participant values.
258 public function testLoadPledgeObjects() {
259 $this->_setUpPledgeObjects();
260 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, $this->_processorId
);
261 $this->assertFalse(empty($this->objects
['pledge_payment'][0]), 'in line ' . __LINE__
);
262 $this->assertTrue(is_a($this->objects
['contributionType'], 'CRM_Financial_BAO_FinancialType'));
263 $this->assertTrue(is_a($this->objects
['contribution'], 'CRM_Contribute_BAO_Contribution'));
264 $this->assertTrue(is_a($this->objects
['pledge_payment'][0], 'CRM_Pledge_BAO_PledgePayment'));
265 $this->assertFalse(empty($this->objects
['pledge_payment'][0]->id
));
266 $this->assertEquals($this->_contributionTypeId
, $this->objects
['contributionType']->id
);
267 $this->assertEquals($this->_processorId
, $this->objects
['paymentProcessor']['id']);
268 $this->assertEquals($this->_contributionId
, $this->objects
['contribution']->id
);
269 $this->assertEquals($this->_contactId
, $this->objects
['contact']->id
);
270 $this->assertEquals($this->_pledgeId
, $this->objects
['pledge_payment'][0]->pledge_id
);
274 * Test that loadObjects works with participant values.
276 public function testLoadPledgeObjectsInvalidPledgeID() {
277 $this->_setUpPledgeObjects();
278 $this->ids
['pledge_payment'][0] = 0;
279 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('return_error' => 1));
280 $this->assertArrayHasKey('error_message', $result);
281 $this->assertArrayNotHasKey('pledge_payment', $this->objects
);
282 $this->assertEquals('Could not find payment processor for contribution record: 1', $result['error_message']);
283 $this->ids
['pledge_payment'][0] = NULL;
284 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('return_error' => 1));
285 $this->assertArrayHasKey('error_message', $result);
286 $this->assertArrayNotHasKey('pledge_payment', $this->objects
);
287 $this->assertEquals('Could not find payment processor for contribution record: 1', $result['error_message']);
288 $this->ids
['pledge_payment'][0] = '';
289 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('return_error' => 1));
290 $this->assertArrayHasKey('error_message', $result);
291 $this->assertArrayNotHasKey('pledge_payment', $this->objects
);
292 $this->assertEquals('Could not find payment processor for contribution record: 1', $result['error_message']);
294 $this->ids
['pledge_payment'][0] = 999;
295 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, $this->_processorId
, array('return_error' => 1));
296 $this->assertArrayHasKey('error_message', $result);
297 $this->assertEquals('Could not find pledge payment record: 999', $result['error_message']);
301 * Test the LoadObjects function with a pledge.
303 public function testsendMailPledge() {
304 $this->_setUpPledgeObjects();
306 $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, NULL);
307 $msg = $this->IPN
->sendMail($this->input
, $this->ids
, $this->objects
, $values, FALSE, TRUE);
308 $this->assertContains('Contribution Information', $msg['html']);
312 * Test that an error is returned if required set & no contribution page
314 public function testRequiredWithoutProcessorID() {
315 $this->_setUpPledgeObjects();
317 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('return_error' => 1));
318 $this->assertArrayHasKey('error_message', $result);
319 $this->assertEquals('Could not find payment processor for contribution record: 1', $result['error_message']);
320 // error is only returned if $required set to True
321 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, NULL, array('return_error' => 1));
322 $this->assertFalse(is_array($result));
323 //check that error is not returned if error checking not set
324 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('log_error' => 1));
325 $this->assertFalse(is_array($result));
330 * Test that an error is not if required set & no processor ID
332 public function testRequiredWithContributionPage() {
333 $this->_setUpContributionObjects(TRUE);
335 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('return_error' => 1));
336 $this->assertFalse(is_array($result), $result['error_message']);
340 * Test that an error is returned if required set & contribution page exists
342 public function testRequiredWithContributionPageError() {
343 $this->_setUpContributionObjects();
345 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('return_error' => 1));
346 $this->assertArrayHasKey('error_message', $result);
347 $this->assertEquals('Could not find contribution page for contribution record: 1', $result['error_message']);
348 // error is only returned if $required set to True
349 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, FALSE, NULL, array('return_error' => 1));
350 $this->assertFalse(is_array($result));
351 //check that error is not returned if error checking not set
352 $result = $this->IPN
->loadObjects($this->input
, $this->ids
, $this->objects
, TRUE, NULL, array('log_error' => 1));
353 $this->assertFalse(is_array($result));
356 /* @codingStandardsIgnoreStart
357 * Test calls main functions in sequence per 'main' - I had hoped to test the functions more
358 * fully but the calls to the POST happen in more than one function
359 * keeping this as good example of data to bring back to life later
361 public function testMainFunctionActions() {
362 $ids = $objects = array( );
363 $input['component'] = 'Contribute';
364 $postedParams = array(
365 'x_response_code' => 1,
366 'x_response_reason_code' => 1,
367 'x_response_reason_text' => 'This transaction has been approved.',
369 'x_auth_code' => 140454,
370 'x_trans_id' => 4353599599,
372 'x_card_type' => 'American Express',
373 'x_account_number' => 'XXXX2701',
374 'x_first_name' => 'Arthur',
375 'x_last_name' => 'Jacobs',
377 'x_address' => '866 2166th St SN',
378 'x_city' => 'Edwardstown',
385 'x_invoice_num' => 'a9fb56c24576lk4c9490f6',
386 'x_description' => 'my desc',
387 'x_type' => 'auth_capture',
389 'x_ship_to_first_name' => null,
390 'x_ship_to_last_name' => null,
391 'x_ship_to_company' => null,
392 'x_ship_to_address' => null,
393 'x_ship_to_city' => null,
394 'x_ship_to_state' => null,
395 'x_ship_to_zip' => null,
396 'x_ship_to_country' => null,
401 'x_tax_exempt' => FALSE,
403 'x_MD5_Hash' => '069ECAD13C8E15AC205CDF92B8B58CC7',
404 'x_cvv2_resp_code' => null,
405 'x_cavv_response' => null,
406 'x_test_request' => false,
407 'description' => 'my description'
409 $this->IPN->getInput( $input, $ids );
410 $this->IPN->getIDs( $ids, $input );
412 CRM_Core_Error::debug_var( '$ids', $ids );
413 CRM_Core_Error::debug_var( '$input', $input );
415 $paymentProcessorID = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessorType',
416 'AuthNet', 'id', 'name' );
418 if ( ! $this->IPN->validateData( $input, $ids, $objects, true, $paymentProcessorID ) ) {
422 if ( $component == 'contribute' && $ids['contributionRecur'] ) {
423 // check if first contribution is completed, else complete first contribution
425 if ( $objects['contribution']->contribution_status_id == 1 ) {
428 return $this->IPN->recur( $input, $ids, $objects, $first );
431 @codingStandardsIgnoreEnd */
434 * Prepare for contribution Test - involving only contribution objects
436 * @param bool $contributionPage
438 public function _setUpContributionObjects($contributionPage = FALSE) {
440 $contribution = new CRM_Contribute_BAO_Contribution();
441 $contribution->id
= $this->_contributionId
;
442 $contribution->find(TRUE);
443 $contributionPageID = NULL;
444 if (!empty($contributionPage)) {
445 $dao = new CRM_Core_DAO();
446 $contribution_page = $dao->createTestObject('CRM_Contribute_DAO_ContributionPage');
447 $contribution->contribution_page_id
= $contributionPageID = $contribution_page->id
;
448 //for unknown reasons trying to do a find & save on a contribution with a receive_date set
449 // doesn't work. This seems of minimal relevance to this test so ignoring
450 // note that in tests it worked sometimes & not others - dependent on which other tests run.
451 // running all CRM_Core tests caused failure as did just the single failing test. But running
452 // just this class succeeds - because it actually doesn't do a mysql update on the following save
454 unset($contribution->receive_date
);
455 $contribution->save();
458 $this->objects
['contribution'] = $contribution;
459 $this->input
= array(
460 'component' => 'contribute',
461 'contribution_page_id' => $contributionPageID,
462 'total_amount' => 110.00,
463 'invoiceID' => "c8acb91e080ad7777a2adc119c192885",
464 'contactID' => $this->_contactId
,
465 'contributionID' => $this->objects
['contribution']->id
,
470 * Prepare for membership test.
472 public function _setUpMembershipObjects() {
474 $this->_membershipTypeID
= $this->membershipTypeCreate();
475 $this->_membershipStatusID
= $this->membershipStatusCreate('test status');
477 catch (Exception
$e) {
478 echo $e->getMessage();
480 CRM_Member_PseudoConstant
::membershipType($this->_membershipTypeID
, TRUE);
481 CRM_Member_PseudoConstant
::membershipStatus(NULL, NULL, 'name', TRUE);
482 $this->_membershipParams
= array(
483 'contact_id' => $this->_contactId
,
484 'membership_type_id' => $this->_membershipTypeID
,
485 'join_date' => '2009-01-21',
486 'start_date' => '2009-01-21',
487 'end_date' => '2009-12-21',
488 'source' => 'Payment',
490 'status_id' => $this->_membershipStatusID
,
494 $membership = $this->callAPISuccess('membership', 'create', $this->_membershipParams
);
496 $this->_membershipId
= $membership['id'];
497 //we'll create membership payment here because to make setup more re-usable
498 civicrm_api('membership_payment', 'create', array(
500 'contribution_id' => $this->_contributionId
,
501 'membership_id' => $this->_membershipId
,
504 $contribution = new CRM_Contribute_BAO_Contribution();
505 $contribution->id
= $this->_contributionId
;
506 $contribution->find();
507 $this->objects
['contribution'] = $contribution;
508 $this->input
= array(
509 'component' => 'contribute',
510 'total_amount' => 150.00,
511 'invoiceID' => "c8acb91e080ad7bd8a2adc119c192885",
512 'contactID' => $this->_contactId
,
513 'contributionID' => $this->objects
['contribution']->id
,
514 'membershipID' => $this->_membershipId
,
517 $this->ids
['membership'] = $this->_membershipId
;
520 public function _setUpRecurringContribution() {
521 $this->_contributionRecurParams
= array(
522 'contact_id' => $this->_contactId
,
525 'frequency_unit' => 'week',
526 'frequency_interval' => 1,
528 'start_date' => date('Ymd'),
529 'create_date' => date('Ymd'),
530 'invoice_id' => 'c8acb91e080ad7bd8a2adc119c192885',
531 'contribution_status_id' => 2,
533 'financial_type_id' => $this->_contributionTypeId
,
535 'payment_processor_id' => $this->_processorId
,
537 $this->_recurId
= civicrm_api('contribution_recur', 'create', $this->_contributionRecurParams
);
538 $this->assertAPISuccess($this->_recurId
, 'line ' . __LINE__
. ' set-up of recurring contrib');
539 $this->_recurId
= $this->_recurId
['id'];
540 $this->input
['contributionRecurId'] = $this->_recurId
;
541 $this->ids
['contributionRecur'] = $this->_recurId
;
545 * Set up participant requirements for test.
547 public function _setUpParticipantObjects() {
548 $event = $this->eventCreate(array('is_email_confirm' => 1));
549 $this->assertAPISuccess($event, 'line ' . __LINE__
. ' set-up of event');
550 $this->_eventId
= $event['id'];
551 $this->_participantId
= $this->participantCreate(array(
552 'event_id' => $this->_eventId
,
553 'contact_id' => $this->_contactId
,
555 //we'll create membership payment here because to make setup more re-usable
556 $participantPayment = civicrm_api('participant_payment', 'create', array(
558 'contribution_id' => $this->_contributionId
,
559 'participant_id' => $this->_participantId
,
561 $this->assertAPISuccess($participantPayment, 'line ' . __LINE__
. ' set-up of event');
562 $contribution = new CRM_Contribute_BAO_Contribution();
563 $contribution->id
= $this->_contributionId
;
564 $contribution->find();
565 $this->objects
['contribution'] = $contribution;
566 $this->input
= array(
567 'component' => 'event',
568 'total_amount' => 150.00,
569 'invoiceID' => "c8acb91e080ad7bd8a2adc119c192885",
570 'contactID' => $this->_contactId
,
571 'contributionID' => $contribution->id
,
572 'participantID' => $this->_participantId
,
575 $this->ids
['participant'] = $this->_participantId
;
576 $this->ids
['event'] = $this->_eventId
;
580 * Set up participant requirements for test.
582 public function _setUpPledgeObjects() {
583 $this->_pledgeId
= $this->pledgeCreate($this->_contactId
);
584 //we'll create membership payment here because to make setup more re-usable
585 $pledgePayment = civicrm_api('pledge_payment', 'create', array(
587 'pledge_id' => $this->_pledgeId
,
588 'contribution_id' => $this->_contributionId
,
590 'actual_amount' => 50,
592 $this->assertAPISuccess($pledgePayment, 'line ' . __LINE__
. ' set-up of pledge payment');
593 $this->input
= array(
594 'component' => 'contribute',
595 'total_amount' => 150.00,
596 'invoiceID' => "c8acb91e080ad7bd8a2adc119c192885",
597 'contactID' => $this->_contactId
,
598 'contributionID' => $this->_contributionId
,
599 'pledgeID' => $this->_pledgeId
,
602 $this->ids
['pledge_payment'][] = $pledgePayment['id'];