Display the notices registered by the payment gateway's process_payment() method (https://github.com/woocommerce/woocommerce-blocks/pull/4871)
We were displaying a generic error and clearing the notices before. Now we convert them to exceptions so they're actually displayed.
This commit is contained in:
parent
ad50a0e7d2
commit
494df12859
|
@ -164,9 +164,8 @@ class Api {
|
|||
// Restore $_POST data.
|
||||
$_POST = $post_data;
|
||||
|
||||
// If `process_payment` added notices, clear them. Notices are not displayed from the API -- payment should fail,
|
||||
// and a generic notice will be shown instead if payment failed.
|
||||
wc_clear_notices();
|
||||
// Display the notices added by `process_payment` and abort.
|
||||
NoticeHandler::convert_notices_to_exceptions( 'woocommerce_rest_payment_error' );
|
||||
|
||||
// Handle result.
|
||||
$result->set_status( isset( $gateway_result['result'] ) && 'success' === $gateway_result['result'] ? 'success' : 'failure' );
|
||||
|
|
Loading…
Reference in New Issue