Skip to content

Commit

Permalink
Remove redundant status seting in IPN
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Apr 4, 2022
1 parent c4b081e commit 8643cee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
13 changes: 0 additions & 13 deletions CRM/Core/Payment/PayPalIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,6 @@ public function recur($input, $recur, $contribution, $first) {
echo 'Failure: Invalid parameters<p>';
return;
}
if ($first) {
$recur->start_date = $now;
}
else {
$recur->modified_date = $now;
}

// make sure the contribution status is not done
// since order of ipn's is unknown
if ($recur->contribution_status_id != $contributionStatuses['Completed']) {
$recur->contribution_status_id = $contributionStatuses['In Progress'];
}
$recur->save();

if (!$first) {
// check if this contribution transaction is already processed
Expand Down
7 changes: 7 additions & 0 deletions tests/phpunit/CRM/Core/Payment/PayPalIPNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
+--------------------------------------------------------------------+
*/

use Civi\Api4\ContributionRecur;

/**
* Class CRM_Core_Payment_PayPalProIPNTest
* @group headless
Expand Down Expand Up @@ -123,6 +125,11 @@ public function testIPNPaymentRecurSuccess(): void {
$mut = new CiviMailUtils($this, TRUE);
$paypalIPN = new CRM_Core_Payment_PayPalIPN($this->getPaypalRecurTransaction());
$paypalIPN->main();
$recur = ContributionRecur::get()
->addWhere('contact_id', '=', $this->_contactID)
->addSelect('contribution_status_id:name')
->execute()->first();
$this->assertEquals('In Progress', $recur['contribution_status_id:name']);
$mut->checkMailLog(['https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_subscr-find'], ['civicrm/contribute/unsubscribe', 'civicrm/contribute/updatebilling']);
$mut->stop();
$contribution1 = $this->callAPISuccess('Contribution', 'getsingle', ['id' => $this->_contributionID]);
Expand Down

0 comments on commit 8643cee

Please sign in to comment.