Merge pull request #13867 from jitendrapurohit/paypalpro
authorEileen McNaughton <eileen@mcnaughty.com>
Sun, 31 Mar 2019 19:13:16 +0000 (08:13 +1300)
committerGitHub <noreply@github.com>
Sun, 31 Mar 2019 19:13:16 +0000 (08:13 +1300)
Possible paypal fix to avoid sending 500 errors from ipn triggerred b…

CRM/Core/Payment/PayPalProIPN.php
tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php

index 369f7f0b3958b4ba36c0976ac1c8f583701e8b3f..9fd23b8d5e966cbe06470c53b4b99c2ac4a5de16 100644 (file)
@@ -426,7 +426,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
     CRM_Core_Error::debug_var('POST', $_POST, TRUE, TRUE);
     if ($this->_isPaymentExpress) {
       $this->handlePaymentExpress();
-      return FALSE;
+      return;
     }
     $objects = $ids = $input = array();
     $this->_component = $input['component'] = self::getValue('m');
@@ -557,6 +557,10 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
     $objects = $ids = $input = array();
     $isFirst = FALSE;
     $input['invoice'] = self::getValue('i', FALSE);
+    //Avoid return in case of unit test.
+    if (empty($input['invoice']) && empty($this->_inputParameters['is_unit_test'])) {
+      return;
+    }
     $input['txnType'] = $this->retrieve('txn_type', 'String');
     $contributionRecur = civicrm_api3('contribution_recur', 'getsingle', array(
       'return' => 'contact_id, id, payment_processor_id',
index 68ede1d3dfe712ca62c43732c31804a4ca48fa4b..949d3aa35c89b3ca292319ad8c5cdb7a411d3340 100644 (file)
@@ -250,6 +250,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase {
       'payment_gross' => '200.00',
       'shipping' => '0.00',
       'ipn_track_id' => '5r27c2e31rl7c',
+      'is_unit_test' => TRUE,
     );
   }