When you cancel a user's recurring WPP payment from PayPal an IPN is sent to your site (if you've set up the IPN Notification Preferences properly) to tell your site the recurring payment has been cancelled. This calls uc_recurring_fee_cancel, which invokes the cancel hook for WPP (uc_recurring_hosted_paypal_wpp_cancel), which sends PayPal a message to say the recurring payment has been cancelled! Because it's already cancelled on PayPal you get a watchdog error generated "Failed to cancel recurring #".

This works fine when the user cancels their own WPP recurring payment from your site. In that case, your site correctly tells PayPal to cancel the recurring payment, which it does and no error is returned.

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dunx’s picture

Issue summary: View changes
dunx’s picture

The $fee and $subscription variables in the WPP cancel hook are no different whether a user or PayPal cancel the recurring charge.

The WPP cancel hook is called before the recurring payment is actually cancelled in the database, so you can't check the database either.

The only way to tell whether it's a user or PayPal cancellation is that the former is performed by a user and the latter anonymously via IPN. My patch checks whether $user->uid is 0 and returns TRUE in that case. Fully tested by me.

Interestingly the "global $user;" at the top of uc_recurring_hosted_paypal_wpp_cancel wasn't actually used by the function; it is now!

I also took the opportunity to correct another watchdog info message in the same function.

[See patch also watchdog type patch at 2499137, which I guess will conflict with this patch.]

dunx’s picture

Status: Active » Needs review
dunx’s picture

FileSize
1.03 KB

And now, the patch against D6 rather than the Master!

apaderno’s picture

Assigned: dunx » Unassigned
Status: Needs review » Closed (outdated)
Issue tags: -watchdog wpp cancel

I am closing this bug report, as it's for a not supported project version. If the bug is reproducible on a supported project version, please re-open this issue.