[ECP-9925-v9] Display error message when 3DS2 challenge is cancelled#3268
[ECP-9925-v9] Display error message when 3DS2 challenge is cancelled#3268shubhamk67 wants to merge 1 commit intomain-9from
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the user experience for Google Pay Express checkouts by ensuring that shoppers receive clear feedback when a 3DS2 challenge is not successfully completed. Instead of a silent failure, an informative error message is now presented, improving transparency and guiding the user through the payment process. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces functionality to display an error message when a 3DS2 challenge is cancelled or refused, leveraging Magento's message manager. A security review found no vulnerabilities. The main feedback for this PR is to improve the accuracy of the displayed error message. The accompanying test files correctly mock new dependencies and verify the new behavior.
| $this->checkoutSession->restoreQuote(); | ||
| $this->messageManager->addErrorMessage(__('The payment is REFUSED.')); | ||
| throw new ValidatorException(__('The payment is REFUSED.')); |
There was a problem hiding this comment.
The current implementation always displays 'The payment is REFUSED.' when handlePaymentsDetailsResponse returns false. However, as per the PR description, this can happen for both 'refused' and 'cancelled' payments. To provide more accurate feedback to the user, it's better to differentiate the message based on the resultCode in the response.
$this->checkoutSession->restoreQuote();
$message = isset($response['resultCode']) && $response['resultCode'] === PaymentResponseHandler::CANCELLED
? __('The payment was cancelled.')
: __('The payment was refused.');
$this->messageManager->addErrorMessage($message);
throw new ValidatorException($message);
|


Description
Previously, if a shopper cancelled the 3DS2 challenge during a Google Pay Express checkout, the window closed silently without providing failure feedback on the screen.
This PR fixes the issue by utilizing Magento's core message manager to persist the error state. Now, when a Google Pay Express payment is refused or cancelled, an error message is displayed.