Skip to content

feat: Update confirmation screen alerts and fee displays for fiat payment#27348

Merged
OGPoyraz merged 3 commits into
mainfrom
ogp/27114
Mar 30, 2026
Merged

feat: Update confirmation screen alerts and fee displays for fiat payment#27348
OGPoyraz merged 3 commits into
mainfrom
ogp/27114

Conversation

@OGPoyraz

@OGPoyraz OGPoyraz commented Mar 11, 2026

Copy link
Copy Markdown
Member

Description

  • Suppress insufficient balance alerts when a fiat payment method is selected - the user is buying with fiat, not spending from token balance
  • Add fiat-specific "no quotes" alert detection: triggers when a fiat method is selected with a valid amount but no quotes are returned
  • Hide bridge time estimate row when fiat is selected — timing is communicated via payment method delay in the Pay-With row
  • Amount input calls updateFiatPayment instead of updateTokenAmount when fiat is selected, and percentage quick-pick buttons are hidden
  • Add hidePercentageButtons prop to DepositKeyboard for fiat mode

Changelog

CHANGELOG entry:

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/7069

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes confirmation amount submission and alert/row visibility logic when a fiat payment method is selected, which can affect when transactions are considered valid/blocking. Risk is moderate due to user-facing confirmation flow changes and new branching based on fiat state.

Overview
Fiat payment mode is now handled as a distinct path in confirmations. When a fiat payment method is selected, the amount "Done" action updates fiat payment state via TransactionPayController.updateFiatPayment instead of committing a token amount.

UI and alerts adapt to fiat selection. DepositKeyboard gains hidePercentageButtons (and tests) to hide percentage quick-picks in fiat mode, BridgeTimeRow no longer renders when a fiat method is selected, useInsufficientPayTokenBalanceAlert returns no alerts under fiat selection, and useNoPayTokenQuotesAlert now also triggers a blocking "no quotes" alert for fiat when a valid fiat amount is entered but quotes/source amounts are empty (with added test coverage).

Written by Cursor Bugbot for commit caa29fe. This will update automatically on new commits. Configure here.

@OGPoyraz OGPoyraz requested a review from a team as a code owner March 11, 2026 12:43
@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Mar 11, 2026
hasValidFiatAmount &&
!isQuotesLoading &&
sourceAmounts?.length === 0 &&
quotes?.length === 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fiat no-quotes alert never triggers with undefined arrays

Medium Severity

sourceAmounts?.length === 0 and quotes?.length === 0 evaluate to false when either value is undefined, because undefined === 0 is false. The selectors selectTransactionPayQuotesByTransactionId and selectTransactionPaySourceAmountsByTransactionId return transactionData?.quotes and transactionData?.sourceAmounts directly, which are undefined when no data exists — not empty arrays. The non-fiat path correctly uses !quotes?.length (truthy for both undefined and []), but the fiat path's strict equality means shouldShowFiatNoQuotesAlert will never be true when the controller hasn't populated these fields, silently suppressing the "no quotes" alert for fiat users.

Fix in Cursor Fix in Web

@OGPoyraz OGPoyraz added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Mar 17, 2026
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 30, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

expect(queryByText('10%')).toBeNull();
expect(queryByText('25%')).toBeNull();
expect(queryByText('50%')).toBeNull();
expect(queryByText('90%')).toBeNull();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tests use toBeNull instead of not.toBeOnTheScreen

Low Severity

The new tests assert element absence using toBeNull() but the Unit Testing Guidelines require not.toBeOnTheScreen() for these checks. Specifically, deposit-keyboard.test.tsx has four expect(queryByText(...)).toBeNull() calls, and bridge-time-row.test.tsx has one. All should use expect(...).not.toBeOnTheScreen() instead.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: Unit Testing Guidelines

@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations, SmokeTrade, SmokePerps, SmokePredictions, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes in this PR introduce fiat payment method support across several confirmation-related components:

  1. deposit-keyboard.tsx: Added hidePercentageButtons prop - when a fiat payment method is selected, percentage quick-select buttons are hidden. This affects the deposit keyboard UI used in Perps, Predictions, and bridge flows.

  2. custom-amount-info.tsx: Modified the handleDone callback to call TransactionPayController.updateFiatPayment() when a fiat payment method is selected (instead of updateTokenAmount()). Also passes hidePercentageButtons to DepositKeyboard. This component is used by perps-deposit-info, predict-deposit-info, predict-withdraw-info, perps-withdraw-info, musd-conversion-info, and confirm-component.

  3. bridge-time-row.tsx: Modified to hide the bridge time estimate row when a fiat payment method is selected - affects bridge confirmation UI.

  4. useInsufficientPayTokenBalanceAlert.ts: Returns empty alerts array when a fiat payment method is selected, preventing false insufficient balance alerts in fiat payment flows.

  5. useNoPayTokenQuotesAlert.ts: Added a new shouldShowFiatNoQuotesAlert condition to show "no quotes" alerts specifically for fiat payment flows.

Tag selection rationale:

  • SmokeConfirmations: Core confirmations infrastructure is modified (alert hooks, confirmation rows, deposit keyboard). All deposit/bridge/swap flows go through confirmations.
  • SmokeTrade: Bridge time row changes directly affect bridge confirmation UI. Bridge flows are part of SmokeTrade. Per tag description, SmokeTrade requires SmokeConfirmations.
  • SmokePerps: custom-amount-info is used by perps-deposit-info and perps-withdraw-info. The fiat payment handling changes affect Perps deposit flows. Per tag description, SmokePerps requires SmokeWalletPlatform and SmokeConfirmations.
  • SmokePredictions: custom-amount-info is used by predict-deposit-info and predict-withdraw-info. Per tag description, SmokePredictions requires SmokeWalletPlatform and SmokeConfirmations.
  • SmokeWalletPlatform: Required by both SmokePerps and SmokePredictions (Trending section contains both Perps and Predictions views).

Performance Test Selection:
The changes are focused on conditional UI rendering (hiding percentage buttons, hiding bridge time row) and alert logic for fiat payment flows. These are not performance-sensitive changes - they don't affect rendering performance, data loading, list rendering, or app startup. No performance tests are warranted.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@OGPoyraz OGPoyraz added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 1fc916e Mar 30, 2026
104 checks passed
@OGPoyraz OGPoyraz deleted the ogp/27114 branch March 30, 2026 11:08
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants