diff --git a/CRM/Core/Payment/Stripe.php b/CRM/Core/Payment/Stripe.php index 258b59a942a1ae9e0ceea66446017d3d40106e7b..f28f260d74843a0df6879ea1eef385fb3491f512 100644 --- a/CRM/Core/Payment/Stripe.php +++ b/CRM/Core/Payment/Stripe.php @@ -1361,4 +1361,33 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment { } $GLOBALS['mockStripeClient'] = $this->stripeClient = $stripeClient; } + + /** + * Handle an error and notify the user + * @fixme: Remove when min version of mjwshared is 1.2.3. + * This is a copy of the updated function that throws an exception on error instead of returning FALSE + * + * @param string $errorCode + * @param string $errorMessage + * @param string $bounceURL + * + * @throws \Civi\Payment\Exception\PaymentProcessorException + * (or statusbounce if URL is specified) + */ + private function handleError($errorCode = NULL, $errorMessage = NULL, $bounceURL = NULL) { + $errorCode = empty($errorCode) ? '' : $errorCode . ': '; + $errorMessage = empty($errorMessage) ? 'Unknown System Error.' : $errorMessage; + $message = $errorCode . $errorMessage; + + Civi::log()->error($this->getPaymentTypeLabel() . ' Payment Error: ' . $message); + if ($this->handleErrorThrowsException) { + // We're in a test environment. Throw exception. + throw new \Exception('Exception thrown to avoid statusBounce because handleErrorThrowsException is set.' . $message); + } + + if ($bounceURL) { + CRM_Core_Error::statusBounce($message, $bounceURL, $this->getPaymentTypeLabel()); + } + throw new PaymentProcessorException($errorMessage, $errorCode); + } } diff --git a/CRM/Stripe/Check.php b/CRM/Stripe/Check.php index 907e40f1a89af11f5b7d5ddce614fbff784ea968..80c78dd1776c2c9764c75c6e62b20682de81af19 100644 --- a/CRM/Stripe/Check.php +++ b/CRM/Stripe/Check.php @@ -25,7 +25,7 @@ class CRM_Stripe_Check { /** * @var string */ - const MIN_VERSION_MJWSHARED = '1.2.3'; + const MIN_VERSION_MJWSHARED = '1.2.2'; const MIN_VERSION_FIREWALL = '1.5.1'; /**