diff --git a/CRM/Core/Payment/Faps.php b/CRM/Core/Payment/Faps.php index e8cbe56c..169940bb 100644 --- a/CRM/Core/Payment/Faps.php +++ b/CRM/Core/Payment/Faps.php @@ -210,15 +210,13 @@ public function buildForm(&$form) { * * @return bool */ - protected function allowSelfService() { + protected function allowSelfService($action) { if ('CRM_Core_Payment_FapsACH' == CRM_Utils_System::getClassName($this)) { return FALSE; } - elseif (!CRM_Core_Permission::check('access CiviContribution')) { - // disable self-service update of billing info if the admin has not allowed it - if (FALSE == $this->getSettings('enable_update_subscription_billing_info')) { - return FALSE; - } + elseif (FALSE == $this->getSettings('enable_'.$action)) { + // disable self-service action if the admin has not allowed it + return FALSE; } return TRUE; } @@ -239,22 +237,20 @@ public function supportsFutureRecurStartDate() { * @return bool */ - /* always allow default ability to update subscription billing info - public function supportsUpdateSubscriptionBillingInfo() { - return $this->allowSelfService(); + public function supportsUpdateSubscriptionBillingInfo() { + return $this->allowSelfService('update_subscription_billing_info'); } - */ public function supportsEditRecurringContribution() { - return $this->allowSelfService(); + return $this->allowSelfService('change_subscription_amount'); } public function supportsChangeSubscriptionAmount() { - return $this->allowSelfService(); + return $this->allowSelfService('change_subscription_amount'); } public function supportsCancelRecurring() { - return $this->allowSelfService(); + return $this->allowSelfService('cancel_recurring'); } /** diff --git a/CRM/Core/Payment/iATSService.php b/CRM/Core/Payment/iATSService.php index 2a17acff..d47c3e95 100644 --- a/CRM/Core/Payment/iATSService.php +++ b/CRM/Core/Payment/iATSService.php @@ -119,15 +119,13 @@ public function isSupported($method) { * * @return bool */ - protected function allowSelfService() { + protected function allowSelfService($action) { if ('CRM_Core_Payment_iATSServiceACHEFT' == CRM_Utils_System::getClassName($this)) { return FALSE; } - elseif (!CRM_Core_Permission::check('access CiviContribution')) { - // disable self-service update of billing info if the admin has not allowed it - if (FALSE == $this->getSettings('enable_update_subscription_billing_info')) { - return FALSE; - } + elseif (FALSE == $this->getSettings('enable_'.$action)) { + // disable self-service 'action' if the admin has not allowed it + return FALSE; } return TRUE; } @@ -147,22 +145,21 @@ public function supportsFutureRecurStartDate() { * * @return bool */ - /* always allow default ability to update subscription billing info + public function supportsUpdateSubscriptionBillingInfo() { - return $this->allowSelfService(); + return $this->allowSelfService('update_subscription_billing_info'); } - */ public function supportsEditRecurringContribution() { - return $this->allowSelfService(); + return $this->allowSelfService('change_subscription_amount'); } public function supportsChangeSubscriptionAmount() { - return $this->allowSelfService(); + return $this->allowSelfService('change_subscription_amount'); } public function supportsCancelRecurring() { - return $this->allowSelfService(); + return $this->allowSelfService('cancel_recurring'); } /** diff --git a/CRM/Iats/Form/Settings.php b/CRM/Iats/Form/Settings.php index f46a9bd2..ff46b3bf 100644 --- a/CRM/Iats/Form/Settings.php +++ b/CRM/Iats/Form/Settings.php @@ -55,6 +55,18 @@ public function buildQuickForm() { ts('Enable self-service updates to recurring contribution Contact Billing Info.') ); + $this->add( + 'checkbox', + 'enable_change_subscription_amount', + ts('Allow self-service updates to recurring contribution amount.') + ); + + $this->add( + 'checkbox', + 'enable_cancel_recurring', + ts('Enable self-service cancellation of a recurring contribution.') + ); + /* These checkboxes are not yet implemented, ignore for now $this->add( 'checkbox', // field type