Skip to content
Snippets Groups Projects
Commit 65bf8b86 authored by mattwire's avatar mattwire
Browse files

Wrap StripeCheckout errors in try/catch and log (but don't report to end-user) the actual error

parent 53a56379
No related branches found
No related tags found
1 merge request!217Implement Stripe Checkout (with support for SEPA and ACH)
......@@ -155,7 +155,6 @@ class CRM_Core_Payment_StripeCheckout extends CRM_Core_Payment_Stripe {
$failUrl = $this->getCancelUrl($paymentParams['qfKey'], NULL);
// Get existing/saved Stripe customer or create a new one
$stripeCustomerID = NULL;
$existingStripeCustomer = \Civi\Api4\StripeCustomer::get(FALSE)
->addWhere('contact_id', '=', $propertyBag->getContactID())
->addWhere('processor_id', '=', $this->getPaymentProcessor()['id'])
......@@ -211,7 +210,13 @@ class CRM_Core_Payment_StripeCheckout extends CRM_Core_Payment_Stripe {
// Allows you to alter the params passed to StripeCheckout (eg. payment_method_types)
CRM_Utils_Hook::alterPaymentProcessorParams($this, $propertyBag, $checkoutSessionParams);
$checkoutSession = $this->stripeClient->checkout->sessions->create($checkoutSessionParams);
try {
$checkoutSession = $this->stripeClient->checkout->sessions->create($checkoutSessionParams);
}
catch (Exception $e) {
$parsedError = $this->parseStripeException('doPayment', $e);
throw new PaymentProcessorException($parsedError['message']);
}
CRM_Stripe_BAO_StripeCustomer::updateMetadata(['contact_id' => $propertyBag->getContactID()], $this, $checkoutSession['customer']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment