Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use cancelSubscription form for cancelling recurring contributions #18196

Closed
wants to merge 1 commit into from

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Aug 19, 2020

Overview

Replaces #16717, follow up to #17146.

Includes #22784 and #21895.

There was existing code to handle cancellation if the processor does not support cancellation.

You may still want to record cancellation reason, see instructions to manually cancel with your provider and send a notification email to the contributor.

But if the processor reports that it does not supportCancelRecurring the form is never displayed and the built in entity enable/disable via javascript is used. This only really makes sense if there is no payment processor.

Before

enable/disable javascript used if processor does not support cancelling recur (cancel link still available in list of recurs!).

After

Always display the cancellation form. Eg. for a recur with payment processor:
image

And without a payment processor:
image

Technical Details

Comments

This cleans up another inconsistency in the way civi handles things. @eileenmcnaughton This finishes off the cancellation stuff we were working on a few versions back.

@civibot
Copy link

civibot bot commented Aug 19, 2020

(Standard links)

@civibot civibot bot added the master label Aug 19, 2020
@mattwire mattwire changed the title Cancelsubscriptionalways Always use cancelSubscription form for cancelling recurring contributions Aug 19, 2020
@mattwire mattwire force-pushed the cancelsubscriptionalways branch from 6347fd1 to 7d4ef13 Compare August 19, 2020 22:13
@eileenmcnaughton
Copy link
Contributor

I'm just going through triaging for 'needs test' & ok without test. I guess the logic is PRs need a test unless we can't see how they could be tested or we know there is existing relevant cover. I think this could be tested.

@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Oct 18, 2020

I took a look at this since a new PR #18787 got raised that addresses some of the same code / makes at least one change that is the same & put up a PR to address the 2 things that stalled this PR #18790

@seamuslee001
Copy link
Contributor

Test fail relates i believe

@eileenmcnaughton
Copy link
Contributor

Yep - there is another open PR related to these links which is where discussion is taking place #18787 - the tldr is that we also need to think about the situation where the appropriate links are different for someone dealing with their own recurring vs someone else's

@mattwire mattwire force-pushed the cancelsubscriptionalways branch from fbc4cd0 to 1f988b0 Compare December 5, 2020 20:22
@mattwire mattwire force-pushed the cancelsubscriptionalways branch 5 times, most recently from a3871e2 to f284c77 Compare February 1, 2021 20:44
@mattwire
Copy link
Contributor Author

mattwire commented Mar 3, 2021

CRM_Contribute_Page_TabTest::testLinks
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<span><a href="/index.php?q=civicrm/contact/view/contributionrecur&amp;reset=1&amp;id=1&amp;cid=3&amp;context=contribution" class="action-item crm-hover-button" title='View Recurring Payment' >View</a><a href="/index.php?q=civicrm/contribute/updaterecur&amp;reset=1&amp;action=update&amp;crid=1&amp;cid=3&amp;context=contribution" class="action-item crm-hover-button" title='Edit Recurring Payment' >Edit</a><a href="/index.php?q=civicrm/contribute/unsubscribe&amp;reset=1&amp;crid=1&amp;cid=3&amp;context=contribution" class="action-item crm-hover-button" title='Cancel' >Cancel</a></span>'
+'<span><a href="/index.php?q=civicrm/contact/view/contributionrecur&amp;reset=1&amp;id=1&amp;cid=3&amp;context=contribution" class="action-item crm-hover-button" title='View Recurring Payment' >View</a><a href="/index.php?q=civicrm/contribute/unsubscribe&amp;reset=1&amp;crid=1&amp;cid=3&amp;context=contribution" class="action-item crm-hover-button" title='Cancel' >Cancel</a></span>'

/home/jenkins/bknix-dfl/build/core-18196-7nonk/web/sites/all/modules/civicrm/tests/phpunit/CRM/Contribute/Page/TabTest.php:55
/home/jenkins/bknix-dfl/build/core-18196-7nonk/web/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php:226
/home/jenkins/bknix-dfl/extern/phpunit7/phpunit7.phar:615

@mattwire mattwire force-pushed the cancelsubscriptionalways branch from f284c77 to 98ee7c9 Compare March 4, 2021 10:19
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request May 3, 2021
This picks up on two of the issues that were blocking on
civicrm#18787 and
civicrm#18196
(but does not solve all of them). It

1) adds the basis for unit test cover and
2) separates the function for retrieving links
for self-service from back office user.

I think there is still some jumbling together of these concepts but
as long as we are careful to extend the tests as we extend the logic...

This fixes what I suspect is an oldish regression whereby the cancel link
for paypal std users was wrong
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request May 3, 2021
This picks up on two of the issues that were blocking on
civicrm#18787 and
civicrm#18196
(but does not solve all of them). It

1) adds the basis for unit test cover and
2) separates the function for retrieving links
for self-service from back office user.

I think there is still some jumbling together of these concepts but
as long as we are careful to extend the tests as we extend the logic...

This fixes what I suspect is an oldish regression whereby the cancel link
for paypal std users was wrong
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request May 3, 2021
This splits out a minor code cleanup from civicrm#18196 (which can probably
build on the unit test work in 20210)
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request May 3, 2021
This picks up on two of the issues that were blocking on
civicrm#18787 and
civicrm#18196
(but does not solve all of them). It

1) adds the basis for unit test cover and
2) separates the function for retrieving links
for self-service from back office user.

I think there is still some jumbling together of these concepts but
as long as we are careful to extend the tests as we extend the logic...

This fixes what I suspect is an oldish regression whereby the cancel link
for paypal std users was wrong
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request May 14, 2021
This picks up on two of the issues that were blocking on
civicrm#18787 and
civicrm#18196
(but does not solve all of them). It

1) adds the basis for unit test cover and
2) separates the function for retrieving links
for self-service from back office user.

I think there is still some jumbling together of these concepts but
as long as we are careful to extend the tests as we extend the logic...

This fixes what I suspect is an oldish regression whereby the cancel link
for paypal std users was wrong
@mattwire mattwire force-pushed the cancelsubscriptionalways branch from 98ee7c9 to 92a01cf Compare May 16, 2021 13:57
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request May 17, 2021
This picks up on two of the issues that were blocking on
civicrm#18787 and
civicrm#18196
(but does not solve all of them). It

1) adds the basis for unit test cover and
2) separates the function for retrieving links
for self-service from back office user.

I think there is still some jumbling together of these concepts but
as long as we are careful to extend the tests as we extend the logic...

This fixes what I suspect is an oldish regression whereby the cancel link
for paypal std users was wrong
@mattwire mattwire force-pushed the cancelsubscriptionalways branch from 92a01cf to 325617f Compare July 5, 2021 11:47
@mattwire mattwire force-pushed the cancelsubscriptionalways branch from 325617f to 023a6cb Compare September 24, 2021 09:33
@mattwire
Copy link
Contributor Author

We can build on this test: #21588

'title' => ts('Cancel'),
'url' => 'civicrm/contribute/unsubscribe',
'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}",
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the above change mean we load Cancel link only for processors supporting cancelRecurring?

But from the description -

After
Always display the cancellation form. Eg. for a recur with payment processor:

it seems the cancel link should always be visible and condition should be checked on the form, i.e, for Send cancellation request to processor field? Is that correct?

With this PR applied, I see the Cancel link is not displayed for processors not having supportsCancelRecurring().

image

@mattwire can you pls clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jitendrapurohit You are right. I've have pushed a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Cancel" link should always display but the form should disable "send cancellation request to processor" if processor does not supportsRecurring()

@mattwire mattwire force-pushed the cancelsubscriptionalways branch from 023a6cb to bc1f2c5 Compare September 30, 2021 21:30
@mattwire mattwire force-pushed the cancelsubscriptionalways branch 2 times, most recently from 663b65e to d310941 Compare February 17, 2022 21:07
@mattwire mattwire force-pushed the cancelsubscriptionalways branch 3 times, most recently from ca0fa1e to edcf036 Compare February 23, 2022 18:59
@BettyDolfing
Copy link

Test this please

@jaapjansma
Copy link
Contributor

jaapjansma commented Apr 11, 2022

@mattwire can you explain what this PR changes? We see the exact same behaviour in https://dmaster.demo.civicrm.org (which does not have this patch). See screenshot below:

Screenshot_20220411_161552

It looks like this PR is not solving anything (or does solve something which has been solved in the mean time).

@jaapjansma jaapjansma added the needs-work-not-review-ready Submitter required to take action, will be closed after 1-2 weeks in this state label Apr 11, 2022
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Apr 14, 2022
…ions

This is civicrm#18196 without the bit I was uncomfortable with
@eileenmcnaughton
Copy link
Contributor

@mattwire I've always shied away from looking at this because of the unexplained changes in getAllProcessors - but the part where you alter the action makes sense to me - so I pulled that part out into a separate PR that I think you can probably merge
#23210

eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Apr 14, 2022
…ions

This is civicrm#18196 without the bit I was uncomfortable with
@mattwire mattwire force-pushed the cancelsubscriptionalways branch from edcf036 to cf2d3c2 Compare April 19, 2022 09:49
@eileenmcnaughton
Copy link
Contributor

@mattwire pr template needs updating now - to explain what the point is of this change / why the PR still exists

@mattwire
Copy link
Contributor Author

mattwire commented May 4, 2022

@eileenmcnaughton Yes, not sure that this bit is still required.

@mattwire mattwire closed this May 4, 2022
@mattwire mattwire deleted the cancelsubscriptionalways branch May 4, 2022 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-test master needs-work-not-review-ready Submitter required to take action, will be closed after 1-2 weeks in this state
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants