Page MenuHomePhabricator

We are creating double contribution recur cancellation activities for Paypal
Closed, ResolvedPublic

Description

It looks like when we cancel on our end, we shortly afterwards get the cancellation back from Paypal and process it in RecurringQueueConsumer::importSubscriptionCancel

Here's a list of contacts with these recent doubled activities (though there are a few others that aren't Paypal that might be something else).

I think we can just not add the activity when we already have a cancellation for the same contribution recur id.

Additionally, the cancellation coming back from Paypal is overwriting the cancellation reason with "(auto) User Cancelled via Gateway" (and also overwriting the cancel and end dates).

Ideally, we'd also like to backfill the cancellation reasons from the log table.

Event Timeline

Ah @Lars we just added (in the last year) the ability to cancel the recurring token from the civi UI. Before that the only way we were getting cancellation info was from IPNs from paypal saying that the donor had cancelled there. I'm guessing we are now getting two IPNs and creating activities for both of them

Change #1219200 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/crm@master] Drop cancel IPNs if already cancelled

https://gerrit.wikimedia.org/r/1219200

Change #1219238 had a related patch set uploaded (by Lars SG; author: Lars SG):

[wikimedia/fundraising/crm@master] Correct overwritten cancellation reasons for paypal recurrings

https://gerrit.wikimedia.org/r/1219238

Lars moved this task from Backlog to In Progress on the Fundraising Tech - Chaos Crew board.
Lars moved this task from In Progress to Ready for Review on the Fundraising Tech - Chaos Crew board.
Lars updated Other Assignee, added: Lars.

Change #1219200 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Drop cancel IPNs if already cancelled

https://gerrit.wikimedia.org/r/1219200

Change #1219889 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/crm@deployment] Drop cancel IPNs if already cancelled

https://gerrit.wikimedia.org/r/1219889

Change #1219889 merged by Ejegg:

[wikimedia/fundraising/crm@deployment] Drop cancel IPNs if already cancelled

https://gerrit.wikimedia.org/r/1219889

XenoRyet triaged this task as Medium priority.Jan 5 2026, 9:11 PM

Change #1219238 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Correct overwritten cancellation reasons for paypal recurrings

https://gerrit.wikimedia.org/r/1219238

@CHudson-WMF This has now been fixed and we have corrected cancellation reasons as far back at this was an issue (Sept 2022). Note we still have the doubled activities, we've only corrected the cancellation reason for the recurring contribution.

That's great! Thanks so much for this. I've made adjustments to the code to accommodate the doubled activities, as well.

XenoRyet set Final Story Points to 4.