X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment.php;h=288359d4e5e5e710820932c2c676b8bbe3eae040;hb=57bab6b5fb5bdc40ef82371c8f0b29cf9237c619;hp=b1df8ec53a13cdb6aa7b42d91d8eac61b4b3ed00;hpb=35844d63c0fcb972769c4431b8524ada76ad8dcf;p=civicrm-core.git diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index b1df8ec53a..288359d4e5 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -354,7 +354,7 @@ abstract class CRM_Core_Payment { * @return bool */ protected function supportsLiveMode() { - return empty($this->_paymentProcessor['is_test']) ? TRUE : FALSE; + return empty($this->_paymentProcessor['is_test']); } /** @@ -363,7 +363,7 @@ abstract class CRM_Core_Payment { * @return bool */ protected function supportsTestMode() { - return empty($this->_paymentProcessor['is_test']) ? FALSE : TRUE; + return !empty($this->_paymentProcessor['is_test']); } /** @@ -551,6 +551,9 @@ abstract class CRM_Core_Payment { * Only explicitly supported contexts are handled without error. * Currently supported: * - contributionPageRecurringHelp (params: is_recur_installments, is_email_receipt) + * - contributionPageContinueText (params: amount, is_payment_to_existing) + * - cancelRecurDetailText (params: mode, amount, currency, frequency_interval, frequency_unit, installments, {membershipType|only if mode=auto_renew}) + * - cancelRecurNotSupportedText * * @param array $params * Parameters for the field, context specific. @@ -590,11 +593,44 @@ abstract class CRM_Core_Payment { } return ts('To complete your contribution, click the Continue button below.'); + case 'cancelRecurDetailText': + if ($params['mode'] === 'auto_renew') { + return ts('Click the button below if you want to cancel the auto-renewal option for your %1 membership. This will not cancel your membership. However you will need to arrange payment for renewal when your membership expires.', + [1 => $params['membershipType']] + ); + } + else { + $text = ts('Recurring Contribution Details: %1 every %2 %3', [ + 1 => CRM_Utils_Money::format($params['amount'], $params['currency']), + 2 => $params['frequency_interval'], + 3 => $params['frequency_unit'], + ]); + if (!empty($params['installments'])) { + $text .= ' ' . ts('for %1 installments', [1 => $params['installments']]) . '.'; + } + $text = "{$text}
"; + $text .= ts('Click the button below to cancel this commitment and stop future transactions. This does not affect contributions which have already been completed.'); + $text .= '
'; + return $text; + } + + case 'cancelRecurNotSupportedText': + return ts('Automatic cancellation is not supported for this payment processor. You or the contributor will need to manually cancel this recurring contribution using the payment processor website.'); + } CRM_Core_Error::deprecatedFunctionWarning('Calls to getText must use a supported method'); return ''; } + /** + * Get the title of the payment processor to display to the user + * + * @return string + */ + public function getTitle() { + return $this->getPaymentProcessor()['title'] ?? $this->getPaymentProcessor()['name']; + } + /** * Getter for accessing member vars. * @@ -605,7 +641,7 @@ abstract class CRM_Core_Payment { * @return null */ public function getVar($name) { - return isset($this->$name) ? $this->$name : NULL; + return $this->$name ?? NULL; } /** @@ -1466,7 +1502,7 @@ abstract class CRM_Core_Payment { */ public static function handlePaymentMethod($method, $params = []) { if (!isset($params['processor_id']) && !isset($params['processor_name'])) { - $q = explode('/', CRM_Utils_Array::value(CRM_Core_Config::singleton()->userFrameworkURLVar, $_GET, '')); + $q = explode('/', CRM_Utils_System::currentPath()); $lastParam = array_pop($q); if (is_numeric($lastParam)) { $params['processor_id'] = $_GET['processor_id'] = $lastParam; @@ -1689,7 +1725,7 @@ INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id ) } // Else default - return isset($this->_paymentProcessor['url_recur']) ? $this->_paymentProcessor['url_recur'] : ''; + return $this->_paymentProcessor['url_recur'] ?? ''; } /**