From 1524a00750883e41e7ca813a109140bfedd03bdd Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Fri, 18 Dec 2015 16:42:49 +1300 Subject: [PATCH] CRM-17731 change from isSupported to supports syntax --- CRM/Contribute/BAO/Contribution.php | 2 +- CRM/Contribute/Form/CancelSubscription.php | 4 ++-- CRM/Contribute/Page/Tab.php | 3 ++- CRM/Core/Payment.php | 2 +- CRM/Core/Payment/PayPalImpl.php | 2 +- CRM/Member/BAO/Membership.php | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 71f1bf9b55..b90887dd62 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2884,7 +2884,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $paymentObject = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($contributionId, 'contribute', 'obj'); if (!empty($paymentObject)) { - $supportsCancel[$cacheKeyString] = $paymentObject->isSupported('cancelSubscription') && !$isCancelled; + $supportsCancel[$cacheKeyString] = $paymentObject->supports('cancelRecurring') && !$isCancelled; } } return $supportsCancel[$cacheKeyString]; diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 2dc9ef4c9a..03d74cbd3b 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -130,7 +130,7 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { */ public function buildQuickForm() { // Determine if we can cancel recurring contribution via API with this processor - $cancelSupported = $this->_paymentProcessorObj->isSupported('cancelSubscription'); + $cancelSupported = $this->_paymentProcessorObj->supports('CancelRecurring'); if ($cancelSupported) { $searchRange = array(); $searchRange[] = $this->createElement('radio', NULL, NULL, ts('Yes'), '1'); @@ -197,7 +197,7 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { if ($this->_selfService) { // for self service force sending-request & notify - if ($this->_paymentProcessorObj->isSupported('cancelSubscription')) { + if ($this->_paymentProcessorObj->supports('cancelRecurring')) { $params['send_cancel_request'] = 1; } diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index 2469e4e8b1..b284ed0118 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -80,11 +80,12 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { if ($recurID) { $paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj'); - if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('cancelSubscription')) { + if (is_object($paymentProcessorObj) && $paymentProcessorObj->supports('cancelRecurring')) { unset(self::$_links[CRM_Core_Action::DISABLE]['extra'], self::$_links[CRM_Core_Action::DISABLE]['ref']); self::$_links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe"; self::$_links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}"; } + if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) { self::$_links[CRM_Core_Action::RENEW] = array( 'name' => ts('Change Billing Details'), diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index d825cbd05d..a10496a4e2 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -1137,7 +1137,7 @@ abstract class CRM_Core_Payment { * * @return bool */ - public function isSupported($method = 'cancelSubscription') { + public function isSupported($method) { return method_exists(CRM_Utils_System::getClassName($this), $method); } diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 377a5613d3..6c1617fc74 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -627,7 +627,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { * * @return bool */ - public function isSupported($method = 'cancelSubscription') { + public function isSupported($method) { if ($this->_paymentProcessor['payment_processor_type'] != 'PayPal') { // since subscription methods like cancelSubscription or updateBilling is not yet implemented / supported // by standard or express. diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 21d8cc2469..7f2f60e163 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1644,7 +1644,7 @@ FROM civicrm_membership_type $paymentObject = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($mid, 'membership', 'obj'); if (!empty($paymentObject)) { - $supportsCancel[$cacheKeyString] = $paymentObject->isSupported('cancelSubscription') && !$isCancelled; + $supportsCancel[$cacheKeyString] = $paymentObject->supports('cancelRecurring') && !$isCancelled; } } return $supportsCancel[$cacheKeyString]; -- 2.25.1