App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-22] [$175] Wallet - Going back from the international bank account success page lets the same account be submitted again

Open applause-bot[bot] opened this issue 2 months ago • 43 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Action Performed:

  1. Go to Account > Wallet > Add bank account.
  2. Select a non-US country (e.g. United Kingdom) and press Next.
  3. Fill in every step with valid details.
  4. On the confirmation page, tick the terms and press Confirm.
  5. On the success page, press the browser Back button (web) or the device Back button (Android).
  6. Press Confirm again.

Expected Result:

The flow closes, or the success page stays. The same bank account cannot be submitted twice.

Actual Result:

The confirmation page for the account just added opens with every detail filled in and the terms ticked. Pressing Confirm submits the same account again.

Workaround:

Unknown.

Platforms:

  • Android: App (reported)
  • Web (reported)

Screenshots/Videos

https://github.com/user-attachments/assets/8331300f-9e6c-48a3-a3f7-fc9d7968f306

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit

applause-bot[bot] avatar Sep 24 '26 17:09 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/922f8851f57ce4d2c9ce8cd61b187498bdd773ae0071eda7e7135f12c604739e

applause-bot[bot] avatar Sep 24 '26 17:09 applause-bot[bot]

Proposal

What is the root cause of that problem?

The "IFSC Code is invalid" string is not an App string — it comes from Corpay via the backend and the App renders it verbatim.

When you pick a bank country, the App calls GetCorpayBankAccountFields and stores the response in the corpayFields Onyx key. Each field carries validationRules[].errorMessage, already rendered in English by the provider. Client-side validation just passes it straight through:

src/pages/settings/Wallet/InternationalDepositAccount/utils.ts:144-154 — only common.error.fieldRequired and the one SWIFT/BIC case added by Fix misleading SWIFT validation guidance for international bank accounts go through translate(). Every other rule, IFSC included, falls through to rule.errorMessage.

Two things make it impossible for this string to be Spanish today:

  1. The App never sends the user's locale on that request — GetCorpayBankAccountFieldsParams.ts only carries countryISO, currency, isWithdrawal, isBusinessBankAccount. preferredLocale is sent on sign-in commands only.
  2. There is no IFSC translation key anywhere in src/languages/ — grep -i ifsc src/ returns nothing.

So this is a systemic gap, not a one-off. The same Corpay strings are rendered raw in several other places, which is why the form already looks half-translated: the field label is English with a Spanish (opcional) suffix at subPages/BankAccountDetails.tsx:102, and dropdown option text and region names are raw too.

What changes do you think we should make in order to solve the problem?

The complete fix is backend-side and outside this repo: send the user's preferredLocale on GetCorpayBankAccountFields and have the backend return localized label, valueSet[].text, and validationRules[].errorMessage. That needs Web-Expensify/Auth changes (and confirmation that Corpay's upstream API accepts a locale), so it should be escalated to an internal engineer rather than solved here.

An App-only mitigation is available following the precedent this team already accepted in #101772, if a full fix isn't wanted now:

  1. Add an addPersonalBankAccount.ifscFormatError key to all src/languages/*.ts files describing the real IFSC format (11 characters: 4 letters, then 0, then 6 alphanumerics).
  2. Generalize the hard-coded SWIFT branch in getValidationErrors into a small lookup keyed by bank country plus field name, so the IFSC rule for IN resolves to that key and SWIFT keeps its current behavior. values.bankCountry is already available inside that function, and scoping by country is required because routingCode is reused for UK sort codes, AU BSB, and others.
  3. Apply the same treatment to the two workspace (NonUSD) copies of this logic, which never received the #101772 fix at all and still render rule.errorMessage raw with no special cases: NonUSD/BankInfo/subSteps/BankAccountDetails.tsx:73 and AccountHolderDetails.tsx:92. Best done by having both call the shared getValidationErrors instead of duplicating it.
  4. Update tests/unit/InternationalDepositAccountUtilsTest.ts:47-62, which currently asserts that non-SWIFT fields preserve the provider message.

Be aware this mitigation only fixes the strings we enumerate. The English field label sitting right above the error stays English either way, so the screen still reads as partly untranslated.

What alternative solutions did you explore? (Optional)

  • Map Corpay's English message text to translation keys. Rejected: keying on provider prose breaks the moment Corpay rewords anything, and there are ~100+ country/currency combinations.
  • Translate everything client-side with a full Corpay string table. Rejected: unbounded maintenance for labels, options, and region names across every supported country.
Verification details and an unverified assumption

Verified from code (App at 05d0f31ea045bcdf2f91b774033bfce870d31ba3):

  • corpayFields.formFields[] is written only by the server's onyxData; the client never populates it. Both entry points are BankAccounts.ts:1479 (fetchCorpayFields, used by this Wallet flow) and BankAccounts.ts:825.
  • Nothing localizes the string downstream: addErrorMessage concatenates it as-is and FormProvider renders it as errorText.
  • The IFSC field lands in the ACCOUNT_DETAILS bucket via utils.ts:34-37, which matches the reported screen.

Not verified: I did not reproduce against the live Corpay response, so I don't know India's exact field id and regex. routingCode is the most likely id — India's IFSC is the routing code, and ReimbursementAccountForm.ts:104-106 notes it pairs with the SWIFT/BIC input. Whoever implements this should confirm the id and regex from an actual GetCorpayBankAccountFields response for countryISO=IN before wiring up the lookup.

Alternative explanation considered and ruled out: that the message is the top-level field.errorMessage or a backend error surfaced on the Confirmation step. Neither fits — field.errorMessage is declared in the type but never read by any App code, and the reported repro shows the error inline on blur, which is the client-side getValidationErrors path.

Related: Wallet- SWIFT code field validation error persist after enter valid code for International BA is the same underlying gap for the SWIFT field, fixed narrowly by #101772. No open duplicate of this IFSC report exists.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/102213) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Sep 24 '26 17:09 MelvinBot

Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)

melvin-bot[bot] avatar Sep 24 '26 17:09 melvin-bot[bot]

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

melvin-bot[bot] avatar Sep 24 '26 17:09 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

When the user's language is set to Spanish and they navigate to Account > Wallet > Add International account for India, entering an invalid IFSC code (e.g. 2–4 characters) and blurring the field displays the error message "IFSC Code is invalid" in English instead of Spanish.


What is the root cause of that problem?

Dynamic form fields and validation rules for international bank accounts are returned by Corpay via the GetCorpayBankAccountFields API command.

In src/pages/settings/Wallet/InternationalDepositAccount/utils.ts (lines 144–154), getValidationErrors() checks input values against each rule's regular expression (rule.regEx):

for (const rule of field.validationRules) {
    const regExpCheck = new RegExp(rule.regEx);
    if (!regExpCheck.test(values[fieldName])) {
        // Corpay's strict SWIFT rule also requires a six-letter prefix, which its message may omit.
        const errorMessage =
            fieldName === INPUT_IDS.ADDITIONAL_DATA.CORPAY.SWIFT_BIC_CODE && rule.regEx === CONST.CORPAY_FIELDS.STRICT_SWIFT_BIC_REGEX
                ? translate('addPersonalBankAccount.swiftBicFormatError')
                : rule.errorMessage;
        addErrorMessage(errors, fieldName, errorMessage);
    }
}

For India (bankCountry === 'IN'), the IFSC field uses the routingCode field name. When the regex check fails, it falls through to rule.errorMessage. Because rule.errorMessage is supplied directly by Corpay in English ("IFSC Code is invalid"), the app renders the unlocalized English string regardless of the user's selected language.

While PR #101772 solved this exact problem for swiftBicCode by introducing translate('addPersonalBankAccount.swiftBicFormatError'), no localized translation key or mapping was added for the Indian IFSC routing code validation.


What changes do you think we should make in order to solve the problem?

  1. Add localized IFSC error messages to src/languages/en.ts and src/languages/es.ts:

In src/languages/en.ts:

addPersonalBankAccount: {
    swiftBicFormatError: 'SWIFT/BIC must be 8 or 11 characters long, with 6 letters followed by 2 or 5 letters or numbers.',
    ifscFormatError: 'IFSC Code is invalid.',

In src/languages/es.ts:

addPersonalBankAccount: {
    swiftBicFormatError: 'El SWIFT/BIC debe tener 8 u 11 caracteres, con 6 letras seguidas de 2 o 5 letras o números.',
    ifscFormatError: 'El código IFSC no es válido.',
  1. In src/pages/settings/Wallet/InternationalDepositAccount/utils.ts: Update getValidationErrors to translate the error when validating the Indian IFSC routing code:
diff --git a/src/pages/settings/Wallet/InternationalDepositAccount/utils.ts b/src/pages/settings/Wallet/InternationalDepositAccount/utils.ts
--- a/src/pages/settings/Wallet/InternationalDepositAccount/utils.ts
+++ b/src/pages/settings/Wallet/InternationalDepositAccount/utils.ts
@@ -145,10 +145,13 @@ function getValidationErrors(values: FormOnyxValues<typeof ONYXKEYS.FORMS.INTER
         for (const rule of field.validationRules) {
             const regExpCheck = new RegExp(rule.regEx);
             if (!regExpCheck.test(values[fieldName])) {
+                const isIndianIFSC = values.bankCountry === 'IN' && (fieldName === INPUT_IDS.ROUTING_CODE || fieldName === 'routingCode');
                 // Corpay's strict SWIFT rule also requires a six-letter prefix, which its message may omit.
                 const errorMessage =
                     fieldName === INPUT_IDS.ADDITIONAL_DATA.CORPAY.SWIFT_BIC_CODE && rule.regEx === CONST.CORPAY_FIELDS.STRICT_SWIFT_BIC_REGEX
                         ? translate('addPersonalBankAccount.swiftBicFormatError')
+                        : isIndianIFSC
+                        ? translate('addPersonalBankAccount.ifscFormatError')
                         : rule.errorMessage;
                 addErrorMessage(errors, fieldName, errorMessage);
             }
  1. Update tests/unit/InternationalDepositAccountUtilsTest.ts: Add unit test cases verifying that when bankCountry === 'IN' and the routingCode fails validation, translateLocal('addPersonalBankAccount.ifscFormatError') is returned.

What alternative solutions did you explore? (Optional)

  • Translating Corpay error messages on the backend: While passing preferredLocale upstream to Corpay or translating on the Web-Expensify backend would be ideal long-term, Corpay's upstream API is third-party and may not support localized validation errors. Handling known provider validation format errors client-side follows the exact architectural precedent established in PR #101772 for swiftBicCode.

ashusatyarthi-wq avatar Sep 27 '26 17:09 ashusatyarthi-wq

Compare branch: https://github.com/ashusatyarthi-wq/App/compare/fix/ifsc-spanish-error-102213

ashusatyarthi-wq avatar Sep 27 '26 17:09 ashusatyarthi-wq

Proposal

What is the root cause of that problem?

Dynamic form fields and validation rules for international bank accounts are returned from Corpay via the GetCorpayBankAccountFields API.

In src/pages/settings/Wallet/InternationalDepositAccount/utils.ts (lines 144–154), getValidationErrors() iterates over each field's validationRules and evaluates input values against rule.regEx:

  • When input validation fails, it defaults to Corpay's raw provider message: rule.errorMessage.
  • For Indian bank accounts (bankCountry === 'IN'), the IFSC field uses the routingCode field, and Corpay provides the error message in English as "IFSC Code is invalid.".
  • Because rule.errorMessage is passed directly to addErrorMessage(errors, fieldName, errorMessage) without translation, the error message remains in English even when the app language is set to Spanish (or any non-English locale).

Recently merged PR #101772 solved this exact problem for swiftBicCode by introducing a localized translation key (addPersonalBankAccount.swiftBicFormatError) and mapping Corpay's strict SWIFT validation failure in getValidationErrors(). However, no corresponding localized translation or mapping was added for the Indian IFSC routing code validation rule.

What changes do you think we should make in order to solve the problem?

Following the exact architectural pattern established in PR #101772:

  1. Add localized IFSC error messages across all language files in src/languages/: Add ifscFormatError under addPersonalBankAccount in src/languages/en.ts, src/languages/es.ts, and the remaining supported locale files (de.ts, fr.ts, it.ts, ja.ts, nl.ts, pl.ts, pt-BR.ts, zh-hans.ts, el.ts):

    • English (en.ts): 'IFSC Code is invalid.'
    • Spanish (es.ts): 'El código IFSC no es válido.'
  2. In src/pages/settings/Wallet/InternationalDepositAccount/utils.ts: In getValidationErrors(), check when the Indian routing code IFSC rule fails (e.g. fieldName === INPUT_IDS.ROUTING_CODE || fieldName === 'routingCode' for Indian bank accounts or matching the IFSC rule identifier) and map the message to translate('addPersonalBankAccount.ifscFormatError') instead of falling back to the raw English rule.errorMessage.

  3. Add unit test coverage in tests/unit/InternationalDepositAccountUtilsTest.ts: Add test cases verifying that when an Indian international deposit account routing code fails validation, translateLocal('addPersonalBankAccount.ifscFormatError') is returned in the errors object.

What alternative solutions did you explore? (Optional)

  • Translating provider error strings on the Web-Expensify backend: Third-party provider APIs like Corpay return static English validation strings. Handling known provider field format errors on the client aligns directly with the established pattern in PR #101772 for swiftBicCode and avoids backend dependency.

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f9f6e0f44dbc3e49

meanusarcanus avatar Sep 27 '26 23:09 meanusarcanus

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Sep 27 '26 23:09 melvin-bot[bot]

@situchan Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Sep 29 '26 21:09 melvin-bot[bot]

@situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Oct 01 '26 21:10 melvin-bot[bot]

@situchan 10 days overdue. Is anyone even seeing these? Hello?

melvin-bot[bot] avatar Oct 05 '26 22:10 melvin-bot[bot]

The error is coming from backend

situchan avatar Oct 07 '26 17:10 situchan

@situchan this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Oct 08 '26 22:10 melvin-bot[bot]

@situchan Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Oct 12 '26 21:10 melvin-bot[bot]

@situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Oct 14 '26 21:10 melvin-bot[bot]

@situchan Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

melvin-bot[bot] avatar Oct 16 '26 21:10 melvin-bot[bot]

@situchan 12 days overdue. Walking. Toward. The. Light...

melvin-bot[bot] avatar Oct 20 '26 21:10 melvin-bot[bot]

@situchan this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Oct 22 '26 21:10 melvin-bot[bot]

This issue has not been updated in over 14 days. @situchan eroding to Weekly issue.

melvin-bot[bot] avatar Oct 23 '26 21:10 melvin-bot[bot]

@situchan Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Nov 03 '26 03:11 melvin-bot[bot]