From: deb.monish Date: Wed, 31 May 2017 12:05:39 +0000 (+0530) Subject: CRM-19478: Handle p=null oddity for Paypal Pro Recurring payments X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d0488f03b2fc2fd7b776e10caaba19ff3943108f;p=civicrm-core.git CRM-19478: Handle p=null oddity for Paypal Pro Recurring payments --- diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index c4a1af336c..a9f62e75fa 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -125,6 +125,14 @@ class 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']); + } + if (!$this->loadObjects($input, $ids, $objects, $required, $paymentProcessorID)) { return FALSE; } diff --git a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php index 573ddaeb6d..e51ff0141a 100644 --- a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php @@ -76,6 +76,8 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase { */ public function testIPNPaymentRecurSuccess() { $this->setupRecurringPaymentProcessorTransaction(); + global $_GET; + $_GET = $this->getPaypalProRecurTransaction(); $paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalProRecurTransaction()); $paypalIPN->main(); $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $this->_contributionID)); @@ -338,7 +340,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase { 'amount_per_cycle' => '15.00', 'mc_gross' => '15.00', 'payment_date' => '03:59:05 Jul 14, 2013 PDT', - 'rp_invoice_id' => 'i=' . $this->_invoiceID . '&m=contribute&c=' . $this->_contactID . '&r=' . $this->_contributionRecurID . '&b=' . $this->_contributionID . '&p=' . $this->_contributionPageID, + 'rp_invoice_id' => 'i=' . $this->_invoiceID . '&m=contribute&c=' . $this->_contactID . '&r=' . $this->_contributionRecurID . '&b=' . $this->_contributionID . '&p=null', 'payment_status' => 'Completed', 'business' => 'nowhere@civicrm.org', 'last_name' => 'Roberty',