Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Fatal Error on contribution tab and user dashboard when recurring payment generated using extension get disabled #22264

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

sunilpawar
Copy link
Contributor

Overview

Step to reproduce:

  1. Install extensions which support recurring payment e.g Stripe.
  2. Create Recurring payment using that processor. (maybe use API Explorer to create it)
  3. Disable extension.
  4. Visit the Contribution tab or user Dashboard screen. you will get a fatal error.

Before

Fatal Error were showing

After

It shows a recurring record with VIEW link.

@civibot
Copy link

civibot bot commented Dec 16, 2021

(Standard links)

@civibot civibot bot added the master label Dec 16, 2021
@sunilpawar sunilpawar changed the title Fix Fatal on contribution tab and user dashboard when recurring payment generated using extension get disabled Fix Fatal Error on contribution tab and user dashboard when recurring payment generated using extension get disabled Dec 16, 2021
@eileenmcnaughton
Copy link
Contributor

@sunilpawar it should be the case that we load the pseudoprocessor (CRM_Core_Manual - id = 0) when there is not 'real' processor. Not sure why that isn't happening but I think it should

@sunilpawar
Copy link
Contributor Author

@eileenmcnaughton in our case we are getting processor id, so its not 0.

$paymentProcessorObj = Civi\Payment\System::singleton()->getById(CRM_Contribute_BAO_ContributionRecur::getPaymentProcessorID($recurID));

function getPaymentProcessorID it just return id associated with recurring record.

as you suggested, i am checking like this, i don't know is it right way and place to add CRM_Core_Payment_Manual object in function getByProcessor, because getByProcessor is used at multiple places.

diff --git a/Civi/Payment/System.php b/Civi/Payment/System.php
index 358ce7f023..6c66c1c68d 100644
--- a/Civi/Payment/System.php
+++ b/Civi/Payment/System.php
@@ -65,6 +65,9 @@ class System {
           $processorObject->setPaymentProcessor($processor);
         }
       }
+      else {
+        return new \CRM_Core_Payment_Manual();
+      }
       $this->cache[$id] = $processorObject;
     }

@eileenmcnaughton
Copy link
Contributor

@sunilpawar I re-read this & I guess it doesn't make sense to return any links if there is no enabled processor - so explictly doing that makes sense on thinking about it - merging

@eileenmcnaughton eileenmcnaughton merged commit 08f00ce into civicrm:master Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants