From 3e473c0b716523dc8aaa61b2a031d756c3b3b1f6 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Fri, 18 Dec 2015 16:06:38 +1300 Subject: [PATCH] Minor tidy up - pass through 'cancel' rather than leave as unintuitive default Fix comments Fix missing return --- CRM/Contribute/BAO/Contribution.php | 4 ++-- CRM/Contribute/BAO/ContributionPage.php | 2 +- CRM/Core/Payment.php | 4 ++++ CRM/Core/Payment/Dummy.php | 5 ++++- CRM/Core/Payment/Manual.php | 5 ++++- CRM/Core/Payment/ProcessorForm.php | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 12c5ee398c..71f1bf9b55 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2348,7 +2348,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $entityID = $ids['membership'][0]; } - $template->assign('cancelSubscriptionUrl', $paymentObject->subscriptionURL($entityID, $entity)); + $template->assign('cancelSubscriptionUrl', $paymentObject->subscriptionURL($entityID, $entity, 'cancel')); $template->assign('updateSubscriptionBillingUrl', $paymentObject->subscriptionURL($entityID, $entity, 'billing')); $template->assign('updateSubscriptionUrl', $paymentObject->subscriptionURL($entityID, $entity, 'update')); @@ -2441,7 +2441,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $template->assign('is_separate_payment', 0); if ($recur && $paymentObject) { - $url = $paymentObject->subscriptionURL($membership->id, 'membership'); + $url = $paymentObject->subscriptionURL($membership->id, 'membership', 'cancel'); $template->assign('cancelSubscriptionUrl', $url); $url = $paymentObject->subscriptionURL($membership->id, 'membership', 'billing'); $template->assign('updateSubscriptionBillingUrl', $url); diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index f7d87eff2a..5bbe2a142e 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -596,7 +596,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio // like in PaypalPro, & therefore we set it here additionally. $template = CRM_Core_Smarty::singleton(); $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recur->id, 'recur', 'obj'); - $url = $paymentProcessor->subscriptionURL($recur->id, 'recur'); + $url = $paymentProcessor->subscriptionURL($recur->id, 'recur', 'cancel'); $template->assign('cancelSubscriptionUrl', $url); $url = $paymentProcessor->subscriptionURL($recur->id, 'recur', 'billing'); diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index db6a77f1e9..d825cbd05d 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -249,6 +249,10 @@ abstract class CRM_Core_Payment { /** * Does this processor support cancelling recurring contributions through code. * + * If the processor returns true it must be possible to take action from within CiviCRM + * that will result in no further payments being processed. In the case of token processors (e.g + * IATS, eWay) updating the contribution_recur table is probably sufficient. + * * @return bool */ protected function supportsCancelRecurring() { diff --git a/CRM/Core/Payment/Dummy.php b/CRM/Core/Payment/Dummy.php index 7a40da5f79..b42d00f5e7 100644 --- a/CRM/Core/Payment/Dummy.php +++ b/CRM/Core/Payment/Dummy.php @@ -127,7 +127,10 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment { } /** - * Are back office payments supported - e.g paypal standard won't permit you to enter a credit card associated with someone else's login + * Are back office payments supported. + * + * E.g paypal standard won't permit you to enter a credit card associated with someone else's login. + * * @return bool */ protected function supportsLiveMode() { diff --git a/CRM/Core/Payment/Manual.php b/CRM/Core/Payment/Manual.php index a2c15bbe9d..f72423bc1c 100644 --- a/CRM/Core/Payment/Manual.php +++ b/CRM/Core/Payment/Manual.php @@ -174,10 +174,12 @@ class CRM_Core_Payment_Manual extends CRM_Core_Payment { } /** - * Submit a payment using Advanced Integration Method. + * Submit a manual payment. * * @param array $params * Assoc array of input parameters for this transaction. + * + * @return array */ public function doDirectPayment(&$params) { $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id'); @@ -187,6 +189,7 @@ class CRM_Core_Payment_Manual extends CRM_Core_Payment { else { $result['payment_status_id'] = array_search('Completed', $statuses); } + return $result; } } diff --git a/CRM/Core/Payment/ProcessorForm.php b/CRM/Core/Payment/ProcessorForm.php index dd493be0bc..f63b4b6a2d 100644 --- a/CRM/Core/Payment/ProcessorForm.php +++ b/CRM/Core/Payment/ProcessorForm.php @@ -68,7 +68,7 @@ class CRM_Core_Payment_ProcessorForm { // also set cancel subscription url if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) { - $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(); + $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(NULL, NULL, 'cancel'); } //checks after setting $form->_paymentProcessor -- 2.25.1