commerce_stripe_submit_form_submit() includes a try/catch block which catches the generic Exception class, but calls Stripe-specific methods on those exceptions.
In case the exception is not a Stripe exception, this causes a PHP fatal like Call to undefined method Exception::getHttpStatus() in commerce_stripe/commerce_stripe.module on line 582

The try/catch should only catch the Stripe exception, and/or should not call Stripe exception methods on non-stripe exceptions.

Comments

aaronbauman created an issue. See original summary.

aaronbauman’s picture

Status: Active » Needs review
StatusFileSize
new2.35 KB

In this patch:
- continue to catch all exceptions, but distinguish between Stripe\Error\Base before calling Stripe-specific methods.
- For non-Stripe exceptions, use Exception::getCode for remote_id and Exception::getTraceAsString for transaction payload.

FYI the use case here is that I need to implement some business logic during hook_commerce_payment_order_paid_in_full, which sometimes throws an exception and should prevent checkout.

torgospizza’s picture

Status: Needs review » Fixed

This is a reasonable and welcome change. (In fact I just saw this error happen to one of our customers.)

Thanks! Committed to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.