refactor: `*_checkout_process_payment_error` to return 400 error code (#45979)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Francesco 2024-04-05 11:44:09 +02:00 committed by GitHub
parent 97d71b25a2
commit 57b8fe8a84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
refactor: `woocommerce_rest_checkout_process_payment_error` returns a `400` response code, instead of `402`.

View File

@ -85,7 +85,7 @@ trait CheckoutTrait {
throw new RouteException( 'woocommerce_rest_checkout_invalid_payment_result', __( 'Invalid payment result received from payment method.', 'woocommerce' ), 500 );
}
} catch ( \Exception $e ) {
throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', $e->getMessage(), 402 );
throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', esc_html( $e->getMessage() ), 400 );
}
}