Skip to content

Commit

Permalink
fix: error handling when saved card and amount too large (#8411)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Pressutto <gpressutto5@gmail.com>
  • Loading branch information
frosso and gpressutto5 authored Mar 18, 2024
1 parent 63ba2e2 commit f15c223
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/payment-utils-when-amount-too-large
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

fix: better error message when saved card and amount too large
2 changes: 2 additions & 0 deletions includes/class-wc-payments-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ public static function get_filtered_error_message( Exception $e ) {
),
wp_strip_all_tags( html_entity_decode( $price ) )
);
} elseif ( $e instanceof API_Exception && 'amount_too_large' === $e->get_error_code() ) {
$error_message = $e->getMessage();
} elseif ( $e instanceof API_Exception && 'wcpay_bad_request' === $e->get_error_code() ) {
$error_message = __( 'We\'re not able to process this request. Please refresh the page and try again.', 'woocommerce-payments' );
} elseif ( $e instanceof API_Exception && ! empty( $e->get_error_type() ) && 'card_error' !== $e->get_error_type() ) {
Expand Down

0 comments on commit f15c223

Please sign in to comment.