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

Fix Failed->Completed for updateContributionCompleted

parent 5bcf6fb4
No related branches found
No related tags found
No related merge requests found
......@@ -301,8 +301,9 @@ trait CRM_Core_Payment_MJWIPNTrait {
// CiviCRM does not (currently) allow changing contribution_status=Failed to anything else.
// But we need to go from Failed to Completed if payment succeeds following a failure.
// So we check for Failed status and update to Pending so it will transition to Completed.
// Fixed in 5.29 with https://github.com/civicrm/civicrm-core/pull/17943
$failedContributionStatus = (int) CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Failed');
if ((int) $this->contribution['contribution_status_id'] === $failedContributionStatus) {
if (isset($params['contribution_status_id']) && ((int) $params['contribution_status_id'] === $failedContributionStatus)) {
$sql = "UPDATE civicrm_contribution SET contribution_status_id=%1 WHERE id=%2";
$queryParams = [
1 => [CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending'), 'Positive'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment