Skip to content

fix: deposit and withdraw flow bugs#1717

Merged
Hugo0 merged 3 commits intomainfrom
fix/prod-bugs
Mar 8, 2026
Merged

fix: deposit and withdraw flow bugs#1717
Hugo0 merged 3 commits intomainfrom
fix/prod-bugs

Conversation

@kushagrasarathe
Copy link
Contributor

@kushagrasarathe kushagrasarathe commented Mar 8, 2026

  • contirbutes to TASK-18699 : fixes withdraw flow broken navigation and state reset
  • also contributes to TASK-18693 : bridge deposit flow missing bank account holder for faster_payments
image

@vercel
Copy link

vercel bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Mar 8, 2026 4:34pm

Request Review

@notion-workspace
Copy link

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

Walkthrough

Adjusts withdrawal navigation/state and bank details rendering; adds UK Faster Payments fields and a default account holder constant; updates transaction receipt UI to show UK sort code/account number and fallback account holder name.

Changes

Cohort / File(s) Summary
Withdrawal flow
src/app/(mobile-ui)/withdraw/page.tsx, src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
Reordered routing to prefer crypto methods, added/used setSelectedBankAccount from useWithdrawFlow, and changed back-navigation to either preserve or clear withdrawal state appropriately (preserve in bank page; clear amount, USD amount, selected method and bank on main withdraw back).
Bank details UI
src/components/AddMoney/components/AddMoneyBankDetails.tsx, src/constants/payment.consts.ts
Always render Account Holder Name row; introduce BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME fallback ('Bridge Building Sp. Z.o.o.') when API lacks a name.
Transaction details & transformer
src/components/TransactionDetails/TransactionDetailsReceipt.tsx, src/components/TransactionDetails/transactionTransformer.ts
Add optional UK Faster Payments fields (sort_code?, account_number?) to deposit instructions, and update receipt UI to render Sort Code/Account Number path alongside IBAN/BIC; use account holder fallback and allow copy on that row.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: deposit and withdraw flow bugs' accurately summarizes the main changes, which address bugs in both deposit and withdraw flows across multiple files.
Description check ✅ Passed The pull request description directly references two task tickets (TASK-18699 and TASK-18693) and their respective issues with the changesets, clearly relating to the modifications across withdraw and deposit flows.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/prod-bugs

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/AddMoney/components/AddMoneyBankDetails.tsx (1)

260-266: Minor typo and consider extracting the fallback constant.

The fix correctly addresses the missing account holder name for faster_payments. Two minor observations:

  1. Typo in comment: "retrun" should be "return"
  2. The hardcoded fallback 'Bridge Building Sp. Z.o.o.' could be extracted to a constant in a shared config file for maintainability (e.g., if the company name changes).
🔧 Suggested improvement
-                    {/* note: fallback to bridge as account holder name, to cover faster_payments onramp requests as bridge currently doesnt retrun a account holder name in api response */}
+                    {/* note: fallback to bridge as account holder name, to cover faster_payments onramp requests as bridge currently doesn't return an account holder name in api response */}
                     <PaymentInfoRow
                         label={'Account Holder Name'}
                         value={onrampData?.depositInstructions?.accountHolderName || 'Bridge Building Sp. Z.o.o.'}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/AddMoney/components/AddMoneyBankDetails.tsx` around lines 260
- 266, Fix the comment typo and extract the hardcoded fallback into a shared
constant: correct "retrun" to "return" in the comment above PaymentInfoRow, and
replace the inline string 'Bridge Building Sp. Z.o.o.' used in PaymentInfoRow
value (onrampData?.depositInstructions?.accountHolderName || 'Bridge Building
Sp. Z.o.o.') with a named constant (e.g., DEFAULT_ACCOUNT_HOLDER or
BRIDGE_COMPANY_NAME) exported from a shared config/consts module so it can be
maintained centrally.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/AddMoney/components/AddMoneyBankDetails.tsx`:
- Around line 260-266: Fix the comment typo and extract the hardcoded fallback
into a shared constant: correct "retrun" to "return" in the comment above
PaymentInfoRow, and replace the inline string 'Bridge Building Sp. Z.o.o.' used
in PaymentInfoRow value (onrampData?.depositInstructions?.accountHolderName ||
'Bridge Building Sp. Z.o.o.') with a named constant (e.g.,
DEFAULT_ACCOUNT_HOLDER or BRIDGE_COMPANY_NAME) exported from a shared
config/consts module so it can be maintained centrally.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee280512-55fe-4be2-8357-6bc2c78337ac

📥 Commits

Reviewing files that changed from the base of the PR and between 4dca8a6 and 6c898c7.

📒 Files selected for processing (3)
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
  • src/app/(mobile-ui)/withdraw/page.tsx
  • src/components/AddMoney/components/AddMoneyBankDetails.tsx
💤 Files with no reviewable changes (1)
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx

@kushagrasarathe
Copy link
Contributor Author

@coderabbitai review in depth.

Evaluate:

  • risk of introducing new bugs and breaking existing functionality
  • performance impact and latency
  • code quality and DRY

Also, write a very concise testing guide for QA

@kushagrasarathe kushagrasarathe requested a review from Hugo0 March 8, 2026 16:32
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Let me gather the full file contents for a thorough review.


🏁 Script executed:

#!/bin/bash
echo "=== withdraw/[country]/bank/page.tsx ==="
cat src/app/\(mobile-ui\)/withdraw/\[country\]/bank/page.tsx

echo ""
echo "=== withdraw/page.tsx ==="
cat src/app/\(mobile-ui\)/withdraw/page.tsx

echo ""
echo "=== AddMoneyBankDetails.tsx ==="
cat src/components/AddMoney/components/AddMoneyBankDetails.tsx

echo ""
echo "=== useWithdrawFlow hook (search) ==="
fd "useWithdrawFlow" --exec cat {}

echo ""
echo "=== WithdrawFlowContext (search) ==="
fd "WithdrawFlowContext" -e tsx -e ts --exec cat {}

Length of output: 59599


@kushagrasarathe: Here is the in-depth review across all three dimensions, plus a QA guide.


🔍 Risk of Introducing New Bugs / Breaking Existing Functionality

withdraw/[country]/bank/page.tsx — Back navigation state preservation ✅ Low Risk

Removing setAmountToWithdraw('') and setSelectedMethod(null) before router.back() is the correct fix. The useEffect guard that redirects to /withdraw when amountToWithdraw is empty was firing before the router could navigate, causing the redirect loop. The SUCCESS view already has its own guard. Preserving state when backing out of the confirm screen is also desirable UX.

One subtle observation: since state is now preserved when going back from the confirm screen, users who edit their bank account selection (from /withdraw/[country]) will still have the old amountToWithdraw in context — but the useEffect redirect logic in withdraw/[country]/bank/page.tsx correctly gates on both amountToWithdraw AND bankAccount, so this is safe.


withdraw/page.tsx — Crypto-first routing ✅ Low Risk

The reordering is correct:

// Before (stale bank account could hijack crypto routing)
else if (selectedBankAccount) { ... }
// After (crypto check is explicit and first)
if (selectedMethod.type === 'crypto') { ... }
else if (selectedBankAccount) { ... }

A user who previously selected a bank account and then switched to crypto would have been incorrectly routed to the bank flow. This fixes that.


withdraw/page.tsx — Full state reset on back navigation ⚠️ Medium Risk

The onPrev handler now aggressively clears amountToWithdraw, usdAmount, selectedMethod, and selectedBankAccount. This is comprehensive and prevents stale-state bugs, but it means any back press from the amount screen forces the user to re-select both method and amount from scratch.

This is a functional correctness vs UX tradeoff. It's the right call for preventing bugs, but worth a QA check to ensure the selectMethod step renders correctly after this reset (especially for showAllWithdrawMethods — note it is not reset here, which seems intentional based on the useEffect at the bottom of the file that calls setShowAllWithdrawMethods(true) when amountFromContext is set).

Pre-existing unhandled throw (not introduced by this PR): in handleAmountContinue, the getCountryFromAccount null path throws an uncaught error inside what is otherwise a synchronous event handler:

} else {
    throw new Error('Failed to get country from bank account') // uncaught
}

This would cause an unhandled exception in the browser. Worth a follow-up fix.


AddMoneyBankDetails.tsx — Always render Account Holder Name ✅ Low Risk

The fallback to BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME is safe and uses a named constant. The row is now allowCopy={true} unconditionally, which is correct since there's always a value to copy.

Minor pre-existing inconsistency (not introduced here): generateBankDetails() — used by the "Share Details" button — still skips Account Holder Name for UK:

if (!isUs && !isMexico && !isUk) {
    bankDetails += `\nAccount Holder Name: ${...}`
}

The shared text will omit the field that is now always shown in the UI for UK. Low severity but worth tracking as a follow-up.


⚡ Performance Impact and Latency

  • No new async operations or network calls introduced.
  • All state resets are synchronous setState calls — negligible re-render cost.
  • The BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME constant fallback avoids any conditional API wait.
  • No new hooks or subscriptions added.

Overall: No meaningful performance impact.


🧹 Code Quality and DRY

Area Observation
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME ✅ Correctly uses a named constant instead of an inline string
methodQueryParam construction ⚠️ Pre-existing: repeated in every routing branch in handleAmountContinue — could be extracted to a variable once, but not introduced by this PR
Context destructuring setSelectedBankAccount was missing from destructuring in withdraw/page.tsx — correctly added
Routing guard comment ✅ Inline comment clearly explains the crypto-first ordering rationale
allowCopy on Account Holder Name ✅ Clean — always true since there's always a value

🧪 QA Testing Guide

Withdraw Flow — Navigation Bug (TASK-18699)

Test A: Back navigation from bank confirm screen preserves state

  1. Go to /withdraw → select a bank account method → enter an amount → hit Continue
  2. On the bank confirm screen (/withdraw/[country]/bank), tap Back
  3. ✅ Should land back on the amount screen with the amount still populated (not redirect to /withdraw)

Test B: Back navigation from amount screen resets all state

  1. Go to /withdraw → select a bank method → reach the amount screen
  2. Tap Back
  3. ✅ Should return to method selection screen with no amount, no method, no bank account pre-selected

Test C: Crypto method routing not hijacked by stale bank account

  1. Complete or partially complete a bank withdrawal (so selectedBankAccount is set in context)
  2. Start a new withdraw, select Crypto method → enter an amount → hit Continue
  3. ✅ Should route to /withdraw/crypto, NOT to /withdraw/[country]/bank

Test D: Success state navigation

  1. Complete a bank withdrawal to the SUCCESS view
  2. Tap the X / back icon
  3. ✅ Should navigate to /home cleanly without redirect loops

Deposit / GBP Onramp — Account Holder Name (TASK-18693)

Test E: Account Holder Name shown for GBP (faster_payments)

  1. Go to /add-money/gb/bank (GBP onramp)
  2. Enter an amount → reach the bank details screen
  3. ✅ "Account Holder Name" row should be visible with value "Bridge Building Sp. Z.o.o."
  4. ✅ Copy button should be functional on that row

Test F: Account Holder Name shown for other countries

  1. Repeat Test E for US, EUR (e.g. DE), MX
  2. ✅ Account Holder Name row should appear for all — for countries where the API returns a name, that name is used; otherwise fallback to "Bridge Building Sp. Z.o.o."

Test G: "Share Details" text for GBP (known pre-existing gap)

  1. On GBP bank details, tap Share Details
  2. ⚠️ Note: Account Holder Name will not appear in the shared text (pre-existing behavior, not a regression from this PR)

🧠 Learnings used
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 852
File: src/hooks/useTransactionHistory.ts:177-239
Timestamp: 2025-05-14T21:16:06.369Z
Learning: When reviewing code, pay attention to and resolve CodeRabbit comments as they can contain useful refactoring suggestions and insights.

Learnt from: CR
Repo: peanutprotocol/peanut-ui PR: 0
File: .cursorrules:0-0
Timestamp: 2026-02-26T21:54:25.278Z
Learning: Applies to docs/PR.md : Maintain a concise docs/PR.md during PR work with: 1) Summary of changes, 2) Risks (what might break), 3) QA guidelines (what to test)

Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 594
File: src/components/Request/Pay/Views/Initial.view.tsx:188-213
Timestamp: 2024-12-31T15:08:15.640Z
Learning: Always resolve coderabbit comments when reviewing code, since they can contain useful suggestions.

Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 0
File: :0-0
Timestamp: 2026-03-04T18:32:51.654Z
Learning: In peanutprotocol/peanut-ui, Bridge-specific add-money and withdraw flows (`src/app/(mobile-ui)/add-money/[country]/bank/page.tsx`, `src/components/AddWithdraw/AddWithdrawCountriesList.tsx`, `src/components/Claim/Link/views/BankFlowManager.view.tsx`) have been migrated (PR `#1713`) to use the unified `isUserKycApproved` from `useKycStatus()` hook instead of per-component `liveKycStatus` + WebSocket state. The migration is complete; no more direct `bridgeKycStatus === 'approved'` checks in those files.

Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1693
File: src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:206-207
Timestamp: 2026-03-04T18:35:17.673Z
Learning: In Bridge-specific add-money and withdraw flows (e.g., src/app/(mobile-ui)/add-money/[country]/bank/page.tsx), liveKycStatus from WebSocket tracks real-time bridge KYC status changes, and bridgeKycStatus is the persisted status. These flows use direct bridgeKycStatus === 'approved' checks instead of the unified isUserKycVerified helper. Migrating to the unified verifier requires careful testing of WebSocket-based real-time status tracking and is deferred to follow-up work.

Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 0
File: :0-0
Timestamp: 2026-01-02T13:14:32.635Z
Learning: In the peanut-ui codebase, the add-money flows (bank and Manteca) use nuqs library for URL-based state management (step, amount, currency via useQueryStates), while RequestFulfillmentFlowContext still uses enum-based context state. This creates intentional partial migration where URL state is used for user-facing flows that benefit from deep linking and bookmarking.

Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 1654
File: src/components/Card/CardGeoScreen.tsx:41-45
Timestamp: 2026-02-02T06:03:48.192Z
Learning: In peanutprotocol/peanut-ui, KYC 2.0 uses the unified entry route '/profile/identity-verification'. Components (e.g., src/components/Card/CardGeoScreen.tsx) should avoid region-specific paths like '/profile/identity-verification/europe/bridge' and navigate to the unified route instead.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/AddMoney/components/AddMoneyBankDetails.tsx`:
- Around line 261-267: The UK faster-payments holder name is only handled in the
JSX PaymentInfoRow but not appended in generateBankDetails(), causing Share
Details to miss it; derive a single resolvedHolderName (e.g., from
onrampData?.depositInstructions?.accountHolderName ||
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME using the existing
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME constant) and reuse that variable in both the
PaymentInfoRow value and in the isUk branch of generateBankDetails() so the
shared text includes an "Account Holder Name" line; update references in the
component to use resolvedHolderName and ensure generateBankDetails() appends the
same resolvedHolderName string.

In `@src/components/TransactionDetails/TransactionDetailsReceipt.tsx`:
- Around line 931-940: The current rendering infers Faster Payments from
presence of sort_code/account_number and falls back to
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME for any missing account_holder_name; instead,
change the logic in TransactionDetailsReceipt.tsx to branch on
extraDataForDrawer.depositInstructions.payment_rail === 'faster_payments' when
deciding labels and copy targets for UK fields (use PaymentInfoRow for "Account
Holder Name" but only use depositInstructions.account_holder_name fallback to
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME inside that faster_payments branch); do not
infer rail from sort_code/account_number, and for missing UK fields inside the
faster_payments branch render "N/A" rather than letting the component fall
through to US account/routing rows; apply the same fix to the other similar
block referenced around the other PaymentInfoRow usage (the duplicated section
noted in the review).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb561233-c7da-4dd7-ae18-b954d014a274

📥 Commits

Reviewing files that changed from the base of the PR and between 6c898c7 and 578925e.

📒 Files selected for processing (4)
  • src/components/AddMoney/components/AddMoneyBankDetails.tsx
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/TransactionDetails/transactionTransformer.ts
  • src/constants/payment.consts.ts

Comment on lines +261 to +267
{/* note: fallback to bridge as account holder name, to cover faster_payments onramp requests as bridge currently doesnt retrun a account holder name in api response */}
<PaymentInfoRow
label={'Account Holder Name'}
value={onrampData?.depositInstructions?.accountHolderName || BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME}
allowCopy
hideBottomBorder
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Share Details still misses the holder name for UK transfers.

This fixes the visible card, but generateBankDetails() still never appends Account Holder Name in the isUk branch. Users copying from Share Details will still get incomplete Faster Payments instructions, and the fallback resolution is now split across two paths. Derive one resolved holder-name value and reuse it in both the PaymentInfoRow and the shared text.

Proposed direction
+    const resolvedAccountHolderName =
+        onrampData?.depositInstructions?.accountHolderName ||
+        (isUk && onrampData?.depositInstructions ? BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME : 'Loading...')
...
-                    <PaymentInfoRow
-                        label={'Account Holder Name'}
-                        value={onrampData?.depositInstructions?.accountHolderName || BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME}
-                        allowCopy
-                        hideBottomBorder
-                    />
+                    <PaymentInfoRow
+                        label={'Account Holder Name'}
+                        value={resolvedAccountHolderName}
+                        allowCopy={resolvedAccountHolderName !== 'Loading...'}
+                        hideBottomBorder
+                    />
         // uk faster payments
         if (isUk) {
             bankDetails += `
+Account Holder Name: ${resolvedAccountHolderName}
 Sort Code: ${onrampData?.depositInstructions?.sortCode || 'Loading...'}
 Account Number: ${onrampData?.depositInstructions?.accountNumber || 'Loading...'}`
         }

As per coding guidelines, "Follow DRY (Don't Repeat Yourself) - reuse existing code and abstract shared functionality; use shared consts from src/constants"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/AddMoney/components/AddMoneyBankDetails.tsx` around lines 261
- 267, The UK faster-payments holder name is only handled in the JSX
PaymentInfoRow but not appended in generateBankDetails(), causing Share Details
to miss it; derive a single resolvedHolderName (e.g., from
onrampData?.depositInstructions?.accountHolderName ||
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME using the existing
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME constant) and reuse that variable in both the
PaymentInfoRow value and in the isUk branch of generateBankDetails() so the
shared text includes an "Account Holder Name" line; update references in the
component to use resolvedHolderName and ensure generateBankDetails() appends the
same resolvedHolderName string.

Comment on lines +931 to +940
{/* note: fallback to bridge as account holder name, to cover faster_payments onramp requests as bridge currently doesnt return an account holder name in api response */}
<PaymentInfoRow
label="Account Holder Name"
value={
transaction.extraDataForDrawer.depositInstructions.account_holder_name ||
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME
}
allowCopy
hideBottomBorder={false}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Select the receipt format from payment_rail, not from missing fields.

depositInstructions.payment_rail is already available, but this change infers Faster Payments from sort_code/account_number presence and applies the holder-name fallback to any missing account_holder_name. A partial Faster Payments payload would now fall through to the US account/routing rows and show the wrong labels/copy targets. Branch on payment_rail === 'faster_payments' instead, then render missing UK fields as N/A inside that branch.

Safer branching
+                                    const isFasterPayments =
+                                        transaction.extraDataForDrawer.depositInstructions.payment_rail ===
+                                        'faster_payments'
...
-                                    <PaymentInfoRow
-                                        label="Account Holder Name"
-                                        value={
-                                            transaction.extraDataForDrawer.depositInstructions.account_holder_name ||
-                                            BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME
-                                        }
-                                        allowCopy
-                                        hideBottomBorder={false}
-                                    />
+                                    <PaymentInfoRow
+                                        label="Account Holder Name"
+                                        value={
+                                            transaction.extraDataForDrawer.depositInstructions.account_holder_name ||
+                                            (isFasterPayments
+                                                ? BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME
+                                                : 'N/A')
+                                        }
+                                        allowCopy={
+                                            !!transaction.extraDataForDrawer.depositInstructions.account_holder_name ||
+                                            isFasterPayments
+                                        }
+                                        hideBottomBorder={false}
+                                    />
...
-                                    ) : transaction.extraDataForDrawer.depositInstructions.sort_code &&
-                                      transaction.extraDataForDrawer.depositInstructions.account_number ? (
+                                    ) : isFasterPayments ? (
                                         <>
                                             <PaymentInfoRow
                                                 label="Sort Code"
-                                                value={transaction.extraDataForDrawer.depositInstructions.sort_code}
-                                                allowCopy
+                                                value={
+                                                    transaction.extraDataForDrawer.depositInstructions.sort_code ||
+                                                    'N/A'
+                                                }
+                                                allowCopy={
+                                                    !!transaction.extraDataForDrawer.depositInstructions.sort_code
+                                                }
                                                 hideBottomBorder
                                             />
                                             <PaymentInfoRow
                                                 label="Account Number"
                                                 value={
-                                                    transaction.extraDataForDrawer.depositInstructions.account_number
+                                                    transaction.extraDataForDrawer.depositInstructions.account_number ||
+                                                    'N/A'
                                                 }
-                                                allowCopy
+                                                allowCopy={
+                                                    !!transaction.extraDataForDrawer.depositInstructions.account_number
+                                                }
                                                 hideBottomBorder
                                             />
                                         </>

Also applies to: 1017-1035

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/TransactionDetails/TransactionDetailsReceipt.tsx` around lines
931 - 940, The current rendering infers Faster Payments from presence of
sort_code/account_number and falls back to BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME
for any missing account_holder_name; instead, change the logic in
TransactionDetailsReceipt.tsx to branch on
extraDataForDrawer.depositInstructions.payment_rail === 'faster_payments' when
deciding labels and copy targets for UK fields (use PaymentInfoRow for "Account
Holder Name" but only use depositInstructions.account_holder_name fallback to
BRIDGE_DEFAULT_ACCOUNT_HOLDER_NAME inside that faster_payments branch); do not
infer rail from sort_code/account_number, and for missing UK fields inside the
faster_payments branch render "N/A" rather than letting the component fall
through to US account/routing rows; apply the same fix to the other similar
block referenced around the other PaymentInfoRow usage (the duplicated section
noted in the review).

@Hugo0 Hugo0 merged commit e7c3ee3 into main Mar 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants