woocommerce / woocommerce-square

Square POS and Payments Integration
https://woo.com/products/square
Other
11 stars 7 forks source link

On Checkout validation, detailed error messages aren't being displayed on Checkout Page #240

Open MiguelAxcar opened 1 week ago

MiguelAxcar commented 1 week ago

When "Debug Mode" is enabled in the WooCommerce Square extension and set to "Show on Checkout Page" or "Both," the detailed error messages fail to appear on the checkout page as expected, showing only the generic user-facing error message. The expected behavior for me is either the detailed message replacing the generic one or both messages being displayed together.

Steps to reproduce

  1. Activate the Square extension.
  2. Navigate to WooCommerce > Settings.
  3. Go to the Square tab.
  4. Access the Advanced Settings section.
  5. Set the Debug Mode field to Show on Checkout Page or Both. Image
  6. Configure the environment to force an error condition (e.g., missing 3D Secure Verification Token).
  7. Add a product to the cart and proceed to the checkout page.

Expected behavior

The detailed error message should be displayed on the checkout page (e.g., "3D Secure Verification Token is missing", or any other you forced to happen).

Current behavior

The checkout page only displays a generic user-facing error message instead of the expected detailed error message, even when debug mode is enabled.

Image


Initial investigation

Just for reference, until we have this fixed, to make the detailed checkout payment gateway error messages to appear on my local environment and fulfill my debugging needs during development, I changed this to the lines below, and it's working as needed.

if ( 'off' == $this->debug_off() ) {
    Square_Helper::wc_add_notice( __( 'An error occurred, please try again or try an alternate form of payment.', 'woocommerce-square' ), 'error' );
} else {
    Square_Helper::wc_add_notice( $exception->getMessage(), 'error' );
    $this->add_debug_message( $exception->getMessage(), 'error' );
}