dev/core#927 Move cancelling of related memberships to extension from BaseIPN
authoreileen <emcnaughton@wikimedia.org>
Fri, 23 Oct 2020 22:44:26 +0000 (11:44 +1300)
committereileen <emcnaughton@wikimedia.org>
Fri, 23 Oct 2020 22:57:40 +0000 (11:57 +1300)
commit6ff69e9ca9d4432dc35fd1b800374c84f1c6b69f
tree0d7999d76c06810fca7e426ee7fa470fd7b892ca
parent7606941f0d75a9e1589d8e3778f015f10c7909b2
dev/core#927 Move cancelling of related memberships to extension from BaseIPN

This moves the code to cancel memberships on a related contribution cancel to the contributioncancelactions
core extension.

Before

The cancellations are done using convoluted & elsewhere duplicated logic in BaseIPN
using convoluted input params

After
When a contribution is updated & the status_id of 'Cancellled' is set then
the hook will kick in, look for any related pending memberships and cancel them.
The test demonstrates that the api call will ensure related pending memberships
are cancelled.

Note that I am using line_items table to get the membership - we have been storing this
membership_payment link there for log enough it should be reliable but if there
are remaining data issues then this is a lower risk flow to flush them out.

Also note that once this is cleaned up I'll move to the 2 other flows I'm aware of
Order.create api & Contribuion form edits
CRM/Core/Payment/BaseIPN.php
ext/contributioncancelactions/contributioncancelactions.php
ext/contributioncancelactions/tests/phpunit/IPNCancelTest.php