Skip to content

fix: filter fiat payment methods by delay and use enabledTransactionTypes#29854

Merged
OGPoyraz merged 6 commits into
mainfrom
ogp/fix-fiat-payment-methods-and-change-flag
May 8, 2026
Merged

fix: filter fiat payment methods by delay and use enabledTransactionTypes#29854
OGPoyraz merged 6 commits into
mainfrom
ogp/fix-fiat-payment-methods-and-change-flag

Conversation

@OGPoyraz

@OGPoyraz OGPoyraz commented May 7, 2026

Copy link
Copy Markdown
Member

Description

Replace the boolean enabled fiat feature flag with a granular enabledTransactionTypes array. The hook now uses hasTransactionType to check whether the current transaction (including nested transactions) matches any enabled type, instead of a simple on/off toggle.

Additionally, payment methods whose upper-bound delay exceeds 10 minutes are now filtered out so only fast payment options are surfaced in the Pay-With modal.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: Fiat payment method filtering

  Scenario: Only fast payment methods are shown
    Given the user opens a confirmation for a transaction type listed in enabledTransactionTypes
    When the Pay-With modal loads
    Then only payment methods with an upper delay ≤ 10 minutes are displayed

  Scenario: Fiat payments disabled for unrecognised transaction type
    Given the user opens a confirmation whose type is NOT in enabledTransactionTypes
    When the Pay-With modal loads
    Then no fiat payment options are shown

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

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 remote-flag shape and gating logic for showing fiat Pay-With options, which can unintentionally hide or expose payment methods for certain confirmation flows if flags are misconfigured. Filtering by delay also alters user-visible payment availability.

Overview
Updates the Pay-With fiat feature flag from a boolean enabled to a structured config with enabledTransactionTypes and maxDelayMinutesForPaymentMethods, including new defaults in selectMetaMaskPayFiatFlags.

useFiatPaymentHighlightedActions now only returns highlighted fiat payment actions when the current (or nested) transaction matches an enabled type via hasTransactionType, and it filters out payment methods whose upper-bound delay exceeds the configured maximum. Tests are updated/expanded to cover the new flag shape, transaction-type gating, and delay-based filtering.

Reviewed by Cursor Bugbot for commit 1bbbfeb. Bugbot is set up for automated code reviews on this repo. Configure here.

@metamaskbotv2 metamaskbotv2 Bot added the team-confirmations Push issues to confirmations team label May 7, 2026
@OGPoyraz OGPoyraz added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label May 7, 2026
@OGPoyraz OGPoyraz changed the title fix: filter fiat payment methods by delay and use enabledTransactionTypes fix: filter fiat payment methods by delay and use enabledTransactionTypes May 7, 2026
@OGPoyraz OGPoyraz marked this pull request as ready for review May 7, 2026 10:23
@OGPoyraz OGPoyraz requested a review from a team as a code owner May 7, 2026 10:23
@github-actions github-actions Bot added the size-S label May 7, 2026
vinistevam
vinistevam previously approved these changes May 7, 2026
Comment thread app/selectors/featureFlagController/confirmations/index.ts
@OGPoyraz OGPoyraz force-pushed the ogp/fix-fiat-payment-methods-and-change-flag branch from ca6f596 to 098bc07 Compare May 7, 2026 11:03

@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.

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.

Reviewed by Cursor Bugbot for commit d27fbf2. Configure here.

maxDelayMinutesForPaymentMethods: number,
): boolean {
return !pm.delay || pm.delay[1] <= maxDelayMinutesForPaymentMethods;
}

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.

Missing guard for malformed delay arrays in filter

Low Severity

isWithinDelayLimit checks !pm.delay which doesn't guard against empty or single-element arrays. When delay is [] or [5], pm.delay[1] is undefined, and undefined <= maxDelay evaluates to false in JavaScript, silently filtering out the payment method. The existing codebase in PaymentMethodListItem.tsx defensively checks Array.isArray(paymentMethod.delay) && paymentMethod.delay.length >= 2 before accessing delay[1], suggesting malformed delay data is possible at runtime.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d27fbf2. Configure here.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations, SmokeMoney
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes refactor the MetaMaskPayFiatFlags feature flag selector from a simple enabled: boolean to a more granular structure with enabledTransactionTypes: TransactionType[] and maxDelayMinutesForPaymentMethods: number. This affects the fiat payment highlighted actions in the confirmation flow.

Key impact chain:

  1. selectMetaMaskPayFiatFlags (selector) → useMMPayFiatConfig (hook) → useFiatPaymentHighlightedActions (hook) → pay-with-modal (component in confirmations)
  2. The pay-with-modal is part of the transaction confirmation UI, making SmokeConfirmations directly relevant
  3. The fiat payment feature is part of MetaMask Card/Money flows, making SmokeMoney directly relevant
  4. Per SmokeMoney tag description: when selecting SmokeMoney for flows that execute transactions, also select SmokeConfirmations

The change is scoped to the pay/fiat payment feature within confirmations. The default value changes from enabled: false to enabledTransactionTypes: [] (effectively still disabled by default), so regression risk is low for other flows. No other tags are impacted as this is isolated to the fiat payment confirmation path.

Performance Test Selection:
The changes are limited to a feature flag selector and confirmation hooks for fiat payment methods. These are not performance-sensitive paths - they involve simple boolean/array checks and filtering of payment methods. No UI rendering performance, data loading, or critical user flow performance concerns are introduced by these changes.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

@OGPoyraz OGPoyraz added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 4517630 May 8, 2026
94 of 96 checks passed
@OGPoyraz OGPoyraz deleted the ogp/fix-fiat-payment-methods-and-change-flag branch May 8, 2026 12:47
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 8, 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.78.0 Issue or pull request that will be included in release 7.78.0 size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants