From e70d499aab6821ab83dec9bfc4f45b8a111b9e9d Mon Sep 17 00:00:00 2001 From: hsingyuc Date: Sun, 17 Dec 2023 22:17:36 -0500 Subject: [PATCH] Update process payment to catch a throwable exception --- includes/class-wc-payment-gateway-wcpay.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index 5e79e04223a..7cb4de12565 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -881,7 +881,6 @@ public function new_process_payment( WC_Order $order ) { * * @return array|null An array with result of payment and redirect URL, or nothing. * @throws Process_Payment_Exception Error processing the payment. - * @throws Exception Error processing the payment. */ public function process_payment( $order_id ) { $order = wc_get_order( $order_id ); @@ -944,7 +943,7 @@ public function process_payment( $order_id ) { $payment_information = $this->prepare_payment_information( $order ); return $this->process_payment_for_order( WC()->cart, $payment_information ); - } catch ( Exception $e ) { + } catch ( Throwable $e ) { // We set this variable to be used in following checks. $blocked_due_to_fraud_rules = $e instanceof API_Exception && 'wcpay_blocked_by_fraud_rule' === $e->get_error_code();