CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Cancel URL differs on receipts sent to Recurring Contrib v each Contrib
Pages: [1]

Author Topic: Cancel URL differs on receipts sent to Recurring Contrib v each Contrib  (Read 366 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Cancel URL differs on receipts sent to Recurring Contrib v each Contrib
November 14, 2014, 12:20:59 am
This is an issue with recurring contributions in 4.5.3. Not sure how to reproduce on Demo as it affects receipts emailed to donors.

I offer a description and a proposed fix, along with some points for discussion.

DESCRIPTION

I use the eWAY recurring payment processor which offers donors the ability to cancel or update recurring contributions. The donor is sent a receipt when the Recurring Contribution is set up, and for each Contribution which is part of the series.

The issue is that the cancel link points to a different place on the Recurring Contribution receipt than it does on the Contribution receipts. Ditto for the update link.

On the Recurring Contribution receipt it is a link like https://example.org/civicrm/contribute/unsubscribe?reset=1&crid=&cs= which is what I want it to be.

On each of the Contribution receipts it is https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?WSDL which is a web service and hopeless for a donor to link to.

PROPOSED FIX

In order for the link to be correct CRM_Core_Payment::subscriptionURL() needs to be called with parameters $entityID = <recurring-contribution-id> and $entity = 'recur'.

This happens for the Recurring Contribution. See /CRM/Contribute/BAO/ContributionPage.php at line 525. But it doesn't happen for Contributions. See /CRM/Contribute/BAO/Contribution.php at line 2118 where $entityID and $entity are both NULL.

The fix I'm proposing is to set $entityID and $entity.

Code: [Select]
--- ../civicrm/CRM/Contribute/BAO/Contribution.php 2014-11-06 06:46:42.000000000 +1100
+++ php/CRM/Contribute/BAO/Contribution.php 2014-11-14 17:27:51.458803339 +1100
@@ -2097,24 +2097,28 @@
     $values = array_merge($this->_gatherMessageValues($input, $values, $ids), $values);
     $template = CRM_Core_Smarty::singleton();
     $this->_assignMessageVariablesToTemplate($values, $input, $template, $recur, $returnMessageText);
     //what does recur 'mean here - to do with payment processor return functionality but
     // what is the importance
     if ($recur && !empty($this->_relatedObjects['paymentProcessor'])) {
       $paymentObject = &CRM_Core_Payment::singleton(
         $this->is_test ? 'test' : 'live',
         $this->_relatedObjects['paymentProcessor']
       );
 
       $entityID = $entity = NULL;
+      if (isset($this->contribution_recur_id) && $this->contribution_recur_id != 0) {
+        $entity = 'recur';
+        $entityID = $this->contribution_recur_id;
+      }
       if (isset($ids['contribution'])) {
         $entity = 'contribution';
         $entityID = $ids['contribution'];
       }
       if (isset($ids['membership']) && $ids['membership']) {
         $entity = 'membership';
         $entityID = $ids['membership'];
       }
 
       $url = $paymentObject->subscriptionURL($entityID, $entity);
       $template->assign('cancelSubscriptionUrl', $url);
 
   

Note that this change allows the NULLs to remain if there is no Recurring Contribution ID, and allows the current behaviour to continue if the 'membership' or 'contribution' IDs are present.

DISCUSSION

Is this merely an issue with the eWAY processor or is it a general glitch?
Should I create an issue and a PR?
« Last Edit: November 14, 2014, 02:59:37 am by ken »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Cancel URL differs on receipts sent to Recurring Contrib v each Contrib

This forum was archived on 2017-11-26.