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

Show recurring contribution links based on payment processor capabilities #12821

Merged
merged 1 commit into from
Oct 7, 2018

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Sep 14, 2018

Overview

In CRM-21512 / #11366 we removed the restriction on editing recurring contributions based on whether they were linked to a membership. However, the "edit" link was still being shown/hidden based on that criteria.

What we should be doing is showing/hiding links based on whether the payment processor actually supports those functions and this PR makes that happen.

Before

  • Edit link does not respect payment processor supports ChangeSubscriptionAmount/EditRecurringContribution.
  • If a payment processor is used but later the extension is disabled the edit/cancel links will still be shown but they will not work because the relevant classes don't exist.

After

  • Edit link is shown/hidden based on result of ChangeSubscriptionAmount/EditRecurringContribution alone.
  • If a payment processor is used but later the extension is disabled the edit/cancel links will not be shown as they will not work. View is still shown as this does not require the payment processor class to exist.

Technical Details

Recent changes to payment processor supportsX methods have made this cleaner and easier to implement.

Comments

@KarinG @eileenmcnaughton @bhahumanists I think you're likely to have an interest

@@ -251,13 +260,6 @@ private function buildRecurringContributionsArray($recurContributions) {
}

if ($recurContributions[$recurId]['is_active']) {
$details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recurContributions[$recurId]['id'], 'recur');
$hideUpdate = $details->membership_id & $details->auto_renew;
Copy link
Contributor

Choose a reason for hiding this comment

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

@mattwire this PR makes sense to me with an exception about the doubts of this one line. It seems the intention of this line was to suppress the editing in the case where auto_renew is set (although the use of a bitwise operator is confusing!).

This is described as.

'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.'

TBH I can barely understand what that means & the code rarely helps! However it seems the issue is not that it is being suppressed for memberships per se but that it is being suppressed for auto_renew memberships. So we need to try to figure out what the impact of auto_renew is....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, this is kind of a "change" but it was already agreed and implemented in https://issues.civicrm.org/jira/browse/CRM-21512 ... It's just we missed this bit. You have been able to navigate directly to the "Edit recurring contribution" page since CRM-21512 was implemented (4.7.30) but the link was not being displayed next to the recurring contribution because of this bit of code.

What it actually means is:

  • BEFORE: Core did not allow editing a recurring contribution if linked to a membership.
  • AFTER: Core does not restrict editing a recurring contribution if linked to a membership.

The "auto_renew" really just means the membership has an associated recurring contribution.

@eileenmcnaughton eileenmcnaughton added the sig:extension support Supports being able to integrate extensions with CiviCRM label Sep 17, 2018
@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Oct 6, 2018

OK - I can't find any evidence of auto-renew usage which is more complicated than is_recurring & I agree this just increases consistency. Does what it says it does. Merging after re-running tests

@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton eileenmcnaughton merged commit cd6fae5 into civicrm:master Oct 7, 2018
@mattwire mattwire deleted the updatesubscription_fix branch March 1, 2019 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge on pass sig:extension support Supports being able to integrate extensions with CiviCRM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants