Skip to content
Snippets Groups Projects
Commit f6c0beee authored by eileen's avatar eileen
Browse files

financial#152 Clean up & test contributionPageID handling

parent 6ed4a274
No related branches found
No related tags found
No related merge requests found
......@@ -80,6 +80,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
if (!$contribution->find(TRUE)) {
throw new CRM_Core_Exception('Failure: Could not find contribution record for ' . (int) $contribution->id, NULL, ['context' => "Could not find contribution record: {$contribution->id} in IPN request: " . print_r($input, TRUE)]);
}
$ids['contributionPage'] = $contribution->contribution_page_id;
// make sure contact exists and is valid
// use the contact id from the contribution record as the id in the IPN may not be valid anymore.
......@@ -106,13 +107,6 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
$objects['contact'] = &$contact;
$objects['contribution'] = &$contribution;
// CRM-19478: handle oddity when p=null is set in place of contribution page ID,
if (!empty($ids['contributionPage']) && !is_numeric($ids['contributionPage'])) {
// We don't need to worry if about removing contribution page id as it will be set later in
// CRM_Contribute_BAO_Contribution::loadRelatedObjects(..) using $objects['contribution']->contribution_page_id
unset($ids['contributionPage']);
}
$this->loadObjects($input, $ids, $objects, TRUE, $paymentProcessorID);
if (!empty($ids['paymentProcessor']) && $objects['contributionRecur']->payment_processor_id != $ids['paymentProcessor']) {
......@@ -321,12 +315,6 @@ INNER JOIN civicrm_contribution co ON co.contribution_recur_id = cr.id
throw new CRM_Core_Exception($message);
}
// get page id based on contribution id
$ids['contributionPage'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution',
$ids['contribution'],
'contribution_page_id'
);
if ($input['component'] == 'event') {
// FIXME: figure out fields for event
}
......
<?php
use Civi\Payment\Exception\PaymentProcessorException;
use Civi\Api4\Contribution;
/**
* Class CRM_Core_Payment_PayPalProIPNTest
......@@ -135,6 +136,11 @@ class CRM_Core_Payment_AuthorizeNetIPNTest extends CiviUnitTestCase {
$this->assertEquals(date('Y-m-d'), substr($updatedContributionRecurAgain['end_date'], 0, 10));
// There should not be any email.
$mut->assertMailLogEmpty();
$contributions = Contribution::get()->addWhere('contribution_recur_id', '=', $this->_contributionRecurID)->addSelect('contribution_page_id')->execute();
foreach ($contributions as $contribution) {
$this->assertEquals($this->_contributionPageID, $contribution['contribution_page_id']);
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment