Skip to content

[ECP-9925-v9] Display error message when 3DS2 challenge is cancelled#3268

Open
shubhamk67 wants to merge 1 commit intomain-9from
ECP-9925-v9
Open

[ECP-9925-v9] Display error message when 3DS2 challenge is cancelled#3268
shubhamk67 wants to merge 1 commit intomain-9from
ECP-9925-v9

Conversation

@shubhamk67
Copy link
Contributor

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.

@shubhamk67 shubhamk67 requested a review from a team as a code owner March 5, 2026 10:54
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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

  • Improved 3DS2 Challenge Feedback: When a Google Pay Express 3DS2 challenge is cancelled or refused, an explicit error message is now displayed to the shopper, preventing silent failures and providing clear feedback.

🧠 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
  • Model/Api/AdyenPaymentsDetails.php
    • Injected Magento's ManagerInterface to handle messages.
    • Added a call to addErrorMessage to display a 'payment refused' message when the handlePaymentsDetailsResponse method returns false.
  • Test/Unit/Model/Api/AdyenPaymentsDetailsTest.php
    • Added ManagerInterface to the mocked dependencies.
    • Updated the setUp method to include the messageManagerMock in the AdyenPaymentsDetails object creation.
    • Added an assertion to verify that addErrorMessage is called once when handlePaymentsDetailsResponse returns false.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 74 to 76
$this->checkoutSession->restoreQuote();
$this->messageManager->addErrorMessage(__('The payment is REFUSED.'));
throw new ValidatorException(__('The payment is REFUSED.'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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);

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
72.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@shubhamk67 shubhamk67 added the Fix Indicates a bug fix label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Indicates a bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant