From c36f488ad3db082111f41c9f1d166776f9d9d274 Mon Sep 17 00:00:00 2001 From: brienne Date: Wed, 9 Aug 2023 13:10:55 -0400 Subject: [PATCH] placement change and add test --- CRM/Core/Payment/PayPalProIPN.php | 2 ++ tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index 2106e136d4..01b4de782c 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -282,6 +282,8 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { break; case 'recurring_payment': + $recur->processor_id = $this->retrieve('recurring_payment_id', 'String'); + $recur->trxn_id = $recur->processor_id; if (!$first) { if ($input['paymentStatus'] !== 'Completed') { throw new CRM_Core_Exception('Ignore all IPN payments that are not completed'); diff --git a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php index c05fac7de2..08f75a0f1f 100644 --- a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php @@ -80,7 +80,8 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase { ->execute(); $this->assertCount(1, $contributions); // source gets set by processor - $contributionRecur = $this->callAPISuccess('contribution_recur', 'getsingle', ['id' => $this->ids['ContributionRecur']['default']]); + $contributionRecur = $this->callAPISuccess('ContributionRecur', 'getsingle', ['id' => $this->ids['ContributionRecur']['default']]); + $this->assertEquals('I-8XHAKBG12SFP', $contributionRecur['processor_id']); $this->assertEquals(5, $contributionRecur['contribution_status_id']); $paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalProRecurSubsequentTransaction()); $paypalIPN->main(); -- 2.25.1