Skip to content

Commit

Permalink
Update process payment to catch a throwable exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyuc committed Dec 18, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d7cf091 commit e70d499
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit e70d499

Please sign in to comment.