Skip to content

Commit

Permalink
Add new process payment exception to the previous
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyuc committed May 22, 2024
1 parent c6aafe3 commit 7ba3671
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ function_exists( 'wcs_order_contains_subscription' )
*
* @param WC_Order $order Order that needs payment.
* @return array|null Array if processed, null if the new process is not supported.
* @throws New_Process_Payment_Exception Error processing the payment.
* @throws Exception Error processing the payment.
*/
public function new_process_payment( WC_Order $order ) {
$manual_capture = $this->get_capture_type() === Payment_Capture_Type::MANUAL();
Expand Down Expand Up @@ -1119,7 +1119,7 @@ public function new_process_payment( WC_Order $order ) {
];
}

throw new New_Process_Payment_Exception( __( 'The payment process could not be completed.', 'woocommerce-payments' ) );
throw new Exception( __( 'The payment process could not be completed.', 'woocommerce-payments' ), 0, new New_Process_Payment_Exception() );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test-class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -3640,7 +3640,7 @@ public function test_new_process_payment_throw_exception() {

$this->card_gateway->process_payment( $order->get_id() );

$this->expectException( New_Process_Payment_Exception::class );
$this->expectException( Exception::class );
$this->expectExceptionMessage( 'The payment process could not be completed.' );
}

Expand Down

0 comments on commit 7ba3671

Please sign in to comment.