Skip to content
Snippets Groups Projects
Commit 8370f486 authored by mattwire's avatar mattwire
Browse files

Catch and log error if Stripe tries to process a duplicate IPN at the same time

parent 4cd794b0
Branches
Tags
1 merge request!141Catch and log error if Stripe tries to process a duplicate IPN at the same time
......@@ -189,7 +189,9 @@ class CRM_Core_Payment_StripeIPN {
return TRUE;
}
else {
$this->createNextContributionForRecur();
if (!$this->createNextContributionForRecur()) {
return FALSE;
}
}
return TRUE;
}
......@@ -214,7 +216,9 @@ class CRM_Core_Payment_StripeIPN {
else {
// We have a recurring contribution but have not yet received invoice.finalized so we don't have the next contribution yet.
// invoice.payment_succeeded sometimes comes before invoice.finalized so trigger the same behaviour here to create a new contribution
$this->createNextContributionForRecur();
if (!$this->createNextContributionForRecur()) {
return FALSE;
}
// Now get the contribution we just created.
$this->getContribution();
}
......@@ -391,7 +395,9 @@ class CRM_Core_Payment_StripeIPN {
* Create the next contribution for a recurring contribution
* This happens when Stripe generates a new invoice and notifies us (normally by invoice.finalized but invoice.payment_succeeded sometimes arrives first).
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
public function createNextContributionForRecur() {
// We have a recurring contribution but no contribution so we'll repeattransaction
......@@ -406,7 +412,7 @@ class CRM_Core_Payment_StripeIPN {
'total_amount' => $this->amount,
'fee_amount' => $this->fee,
];
$this->repeatContribution($params);
return $this->repeatContribution($params);
// Don't touch the contributionRecur as it's updated automatically by Contribution.repeattransaction
}
......
......@@ -9,6 +9,13 @@ Releases use the following numbering system:
* **[BC]**: Items marked with [BC] indicate a breaking change that will require updates to your code if you are using that code in your extension.
## Release 6.5.5 (not yet released 2020-11-17)
**Requires mjwshared (Payment Shared) 0.9.9**
* Catch and log error if Stripe tries to process a duplicate IPN at the same time. This should resolve issues with "Contribution already completed" exceptions in the logs.
* The attempted processing of a duplicate does not seem to cause any data issues but does trigger an exception which is logged. This doesn't fix that underlying issue but
does write a more user-friendly error with context to the CiviCRM logs.
## Release 6.5.4
**This release REQUIRES that you upgrade mjwshared to 0.9.7**.
......
......@@ -15,9 +15,9 @@
<author>Matthew Wire (MJW Consulting)</author>
<email>mjw@mjwconsult.co.uk</email>
</maintainer>
<releaseDate>2020-11-09</releaseDate>
<version>6.5.4</version>
<develStage>stable</develStage>
<releaseDate>2020-11-17</releaseDate>
<version>6.5.5-dev</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.28</ver>
</compatibility>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment