ran into a rather obtuse error with with paypal standard IPNs.
to set it up, create a payment processor record using paypal standard. disable it. create a new payment processor record using paypal standard and attach to a contribution page. run a payment on the page. result: the payment remains in pending status because the IPN cannot locate the payment processor.
I traced it and the issue seems to originate in CRM/Core/Payment/PayPalIPN.php, around line 324, where we have:
This pulls the first available payment processor of type PayPal Standard – even if it's not the one used by this particular contribution. A few thoughts:
- in my case, the error was triggered because that ID makes its way to CRM/Contribute/BAO/Contribution.php around line 2351 (loadRelatedObjects) where we use the ID to retrieve the paymentProcessor. that then triggers an error in BaseIPN.php because no paymentProcessor is retrieved (since it's disabled). I suspect if the first processor was enabled it would succeed – even though it would be attached to the wrong payment processor.
- it seems the primary issue is that we need to know what payment processor was used for the transaction at that point in the process. it seems we should be able to know that from the contribution ID. but I'm always a bit fuzzy as to what should be retrieved from data and what is used by the IPN POST as a check/balance against the contribution.