Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerifyBuyerError not caught or handled in validation #85

Open
joedarsh opened this issue Mar 22, 2024 · 0 comments
Open

VerifyBuyerError not caught or handled in validation #85

joedarsh opened this issue Mar 22, 2024 · 0 comments
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug.

Comments

@joedarsh
Copy link

Describe the bug

If a customer manually declines/cancels SCA verification in banking app, the Square SDK verifyBuyer method throws a VerifyBuyerError, however there is no catch statement on these promises (assets/js/frontend/wc-square.js lines 309 and 414) which results in this error not being caught, the checkout form remaining locked, and no error message being displayed to the customer.

To reproduce

  1. Enter credit card details and submit payment
  2. When SCA challenge is presented, cancel it via bank
  3. VerifyBuyerError is thrown uncaught and validation bails out with no error handling

Expected behavior

VerifyBuyerError is caught and passed to handle_error method to display message to user and unblock checkout UI.

Environment (please complete the following information):

  • WordPress Version: 6.4.3
  • WooCommerce Version: 8.7.0
  • WooCommerce Square Plugin Version: 4.5.1
  • Browser [e.g. chrome, safari] and Version: Chrome 122.0.6261.129

Additional details

I've tested locally adding a simple catch statement manually, and it resolved the issue:

this.get_verification_details().then((verificationDetails) => {
	return this.payments
	        .verifyBuyer(token, verificationDetails)
		.then((verificationResult) => {
			this.handle_verify_buyer_response(
				false,
				verificationResult
			);
		}) // no catch statement here so VerifyBuyerError is not caught

               // tested adding this manually resolves the issue:
               .catch((error) => {
                       this.handle_error([error]);
               });
});
@vikrampm1 vikrampm1 added priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug. labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

2 participants