Alright, now that I've solved the problem, let me reiterate over the issues, and how they were solved.
Problem 1: Wordpress Dev Site Test Contributions Marked Pending
Test contributions were being marked as Pending (Incomplete Transaction)
. As was identified via logs, and confirmed by looking at the IPN history for the sandbox, the notification URL was referencing the Wordpress backend.
As a result, I needed to figure out how to change this. As the docs state:
Enter your CiviCRM site home page (e.g. http://www.example.com) as the Notification URL. This is a placeholder. CiviContribute will pass the exact IPN 'listener' URL to PayPal automatically during each transaction.
Solution
The solution required setting the $frontend
argument to TRUE
for the call to CRM_Utils_System::url
as seen in CRM/Core/Payment.php
(code reference).
So instead of
protected function getNotifyUrl() {
$url = CRM_Utils_System::url(
'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
array(),
TRUE,
NULL,
FALSE
);
return (stristr($url, '.')) ? $url : '';
}
it's now
protected function getNotifyUrl() {
$url = CRM_Utils_System::url(
'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
array(),
TRUE,
NULL,
FALSE,
TRUE // This is the argument that needs to be added
);
return (stristr($url, '.')) ? $url : '';
}
For those interested, here's a link to the method definition.
Why I haven't seen this pop up elsewhere, I am not sure. It may be prudent to do a check, and if Wordpress or Joomla are being used, to set that argument.
After making that change though, notifications started flowing.
Problem 2: Drupal Prod Site Test Contributions Marked Pending as Well
As mentioned in the initial post, test contributions also appeared to not be getting IPN notifications, where they used to previously.
Solution
This was actually fixed while I was working on the fix for the Wordpress problem.
As it turns out, when I was initially testing with Wordpress, the relatively short order hits against the admin area by the IPN notifications caused modsec to blackball the IP that Paypal's Sandbox sends the notifications from.
Once I removed the IP from the deny list, the notifications resumed flowing, and the test contributions resumed processing correctly.