From 3169df24490acf3529410fef4ff7827d504623a3 Mon Sep 17 00:00:00 2001 From: Huu Le <20178761+huult@users.noreply.github.com> Date: Tue, 17 Jun 2025 11:15:34 +0700 Subject: [PATCH 1/3] update translate error message bank account deletion spanish --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/libs/actions/BankAccounts.ts | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 8f9b0d2567b3d..3460387633282 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2417,6 +2417,8 @@ const translations = { validationAmounts: 'The validation amounts you entered are incorrect. Please double check your bank statement and try again.', fullName: 'Please enter a valid full name', ownershipPercentage: 'Please enter a valid percentage number', + deletePaymentBankAccount: + "This bank account can't be deleted because it is used for Expensify Card payments. If you would still like to delete this account, please reach out to Concierge.", }, }, addPersonalBankAccount: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 20602ee5597b2..70ad80e4132fd 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2438,6 +2438,8 @@ const translations = { validationAmounts: 'Los importes de validación que introduciste son incorrectos. Por favor, comprueba tu cuenta bancaria e inténtalo de nuevo.', fullName: 'Por favor, introduce un nombre completo válido', ownershipPercentage: 'Por favor, ingrese un número de porcentaje válido', + deletePaymentBankAccount: + 'Esta cuenta bancaria no se puede eliminar porque se utiliza para pagos con la tarjeta Expensify. Si aún deseas eliminar esta cuenta, por favor contacta con Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index 7775adf878628..837ef3f02ae6c 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -1,3 +1,4 @@ +import type {OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; import type {OnfidoDataWithApplicantID} from '@components/Onfido/types'; @@ -26,6 +27,7 @@ import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; import type {InternationalBankAccountForm, PersonalBankAccountForm} from '@src/types/form'; import type {ACHContractStepProps, BeneficialOwnersStepProps, CompanyStepProps, ReimbursementAccountForm, RequestorStepProps} from '@src/types/form/ReimbursementAccountForm'; +import type {BankAccountList} from '@src/types/onyx'; import type PlaidBankAccount from '@src/types/onyx/PlaidBankAccount'; import type {BankAccountStep, ReimbursementAccountStep, ReimbursementAccountSubStep} from '@src/types/onyx/ReimbursementAccount'; import type {OnyxData} from '@src/types/onyx/Request'; @@ -48,6 +50,13 @@ export {openOnfidoFlow, answerQuestionsForWallet, verifyIdentity, acceptWalletTe type AccountFormValues = typeof ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT_FORM | typeof ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM; +let bankAccountList: OnyxEntry; + +Onyx.connect({ + key: ONYXKEYS.BANK_ACCOUNT_LIST, + callback: (value) => (bankAccountList = value), +}); + function clearPlaid(): Promise { Onyx.set(ONYXKEYS.PLAID_LINK_TOKEN, ''); Onyx.set(ONYXKEYS.PLAID_CURRENT_EVENT, null); @@ -266,6 +275,13 @@ function addPersonalBankAccount(account: PlaidBankAccount, policyID?: string, so function deletePaymentBankAccount(bankAccountID: number) { const parameters: DeletePaymentBankAccountParams = {bankAccountID}; + const bankAccount = bankAccountList ? bankAccountList[bankAccountID] : undefined; + + const bankAccountFailureData = { + ...bankAccount, + errors: getMicroSecondOnyxErrorWithTranslationKey('bankAccount.error.deletePaymentBankAccount'), + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, + }; const onyxData: OnyxData = { optimisticData: [ @@ -285,6 +301,16 @@ function deletePaymentBankAccount(bankAccountID: number) { value: {[bankAccountID]: null}, }, ], + + failureData: [ + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.BANK_ACCOUNT_LIST}`, + value: { + [bankAccountID]: bankAccountFailureData, + }, + }, + ], }; API.write(WRITE_COMMANDS.DELETE_PAYMENT_BANK_ACCOUNT, parameters, onyxData); From a07f354139190ea229318e04ff0aab01459b36ab Mon Sep 17 00:00:00 2001 From: Huu Le <20178761+huult@users.noreply.github.com> Date: Wed, 18 Jun 2025 09:27:04 +0700 Subject: [PATCH 2/3] update translation --- src/languages/de.ts | 2 ++ src/languages/fr.ts | 2 ++ src/languages/it.ts | 2 ++ src/languages/ja.ts | 1 + src/languages/nl.ts | 2 ++ src/languages/pl.ts | 2 ++ src/languages/pt-BR.ts | 2 ++ src/languages/zh-hans.ts | 1 + 8 files changed, 14 insertions(+) diff --git a/src/languages/de.ts b/src/languages/de.ts index 653bac3d47181..2b50295a9c530 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -2452,6 +2452,8 @@ const translations = { validationAmounts: 'Die eingegebenen Validierungsbeträge sind falsch. Bitte überprüfen Sie Ihren Kontoauszug und versuchen Sie es erneut.', fullName: 'Bitte geben Sie einen gültigen vollständigen Namen ein', ownershipPercentage: 'Bitte geben Sie eine gültige Prozentzahl ein.', + deletePaymentBankAccount: + 'Dieses Bankkonto kann nicht gelöscht werden, da es für Expensify-Karten-Zahlungen verwendet wird. Wenn Sie dieses Konto trotzdem löschen möchten, wenden Sie sich bitte an den Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 0cefe1d7f5a9d..1d9c6938ed0b0 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -2450,6 +2450,8 @@ const translations = { validationAmounts: 'Les montants de validation que vous avez saisis sont incorrects. Veuillez vérifier votre relevé bancaire et réessayer.', fullName: 'Veuillez entrer un nom complet valide', ownershipPercentage: 'Veuillez entrer un nombre en pourcentage valide', + deletePaymentBankAccount: + 'Ce compte bancaire ne peut pas être supprimé car il est utilisé pour les paiements par carte Expensify. Si vous souhaitez toujours supprimer ce compte, veuillez contacter le Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/languages/it.ts b/src/languages/it.ts index e18ee160cc5db..76b57dd165a74 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -2436,6 +2436,8 @@ const translations = { validationAmounts: "Gli importi di convalida inseriti non sono corretti. Si prega di ricontrollare l'estratto conto bancario e riprovare.", fullName: 'Per favore, inserisci un nome completo valido', ownershipPercentage: 'Per favore, inserisci un numero percentuale valido', + deletePaymentBankAccount: + 'Questo conto bancario non può essere eliminato perché viene utilizzato per i pagamenti con la carta Expensify. Se desideri comunque eliminare questo conto, contatta il Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 12f47873f7059..6bd4623fbf5b1 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -2427,6 +2427,7 @@ const translations = { validationAmounts: '入力された検証金額が正しくありません。銀行の明細をもう一度確認して、再試行してください。', fullName: '有効なフルネームを入力してください', ownershipPercentage: '有効なパーセンテージの数字を入力してください', + deletePaymentBankAccount: 'この銀行口座はExpensifyカードの支払いに使用されているため、削除できません。それでもこの口座を削除したい場合は、コンシェルジュにお問い合わせください。', }, }, addPersonalBankAccount: { diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 9c366528acd50..3f979fb7e12b9 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -2437,6 +2437,8 @@ const translations = { validationAmounts: 'De ingevoerde validatiebedragen zijn onjuist. Controleer uw bankafschrift en probeer het opnieuw.', fullName: 'Voer een geldige volledige naam in alstublieft', ownershipPercentage: 'Voer een geldig percentage in.', + deletePaymentBankAccount: + 'To konto bankowe nie może zostać usunięte, ponieważ jest używane do płatności kartą Expensify. Jeśli mimo to chcesz usunąć to konto, skontaktuj się z Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 03d16997b7c5d..a3ac79f6b559b 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -2431,6 +2431,8 @@ const translations = { validationAmounts: 'Kwoty weryfikacyjne, które wprowadziłeś, są nieprawidłowe. Proszę dokładnie sprawdzić wyciąg bankowy i spróbować ponownie.', fullName: 'Proszę wprowadzić prawidłowe pełne imię i nazwisko', ownershipPercentage: 'Proszę wprowadzić prawidłową liczbę procentową', + deletePaymentBankAccount: + 'To konto bankowe nie może zostać usunięte, ponieważ jest używane do płatności kartą Expensify. Jeśli mimo to chcesz usunąć to konto, skontaktuj się z Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index 07508ead53b6c..f19b68d329d91 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -2434,6 +2434,8 @@ const translations = { validationAmounts: 'Os valores de validação que você inseriu estão incorretos. Por favor, verifique novamente seu extrato bancário e tente novamente.', fullName: 'Por favor, insira um nome completo válido.', ownershipPercentage: 'Por favor, insira um número percentual válido', + deletePaymentBankAccount: + 'Este banco conta não pode ser excluída porque é usada para pagamentos do Cartão Expensify. Se ainda assim deseja excluir essa conta, entre em contato com o Concierge.', }, }, addPersonalBankAccount: { diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index a86c38877629a..9ab7cecfa24b3 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -2406,6 +2406,7 @@ const translations = { validationAmounts: '您输入的验证金额不正确。请仔细检查您的银行对账单,然后重试。', fullName: '请输入有效的全名', ownershipPercentage: '请输入一个有效的百分比数字', + deletePaymentBankAccount: '由于该银行账户用于Expensify卡支付,因此无法删除。如果您仍希望删除此账户,请联系Concierge。', }, }, addPersonalBankAccount: { From d2a0b55d0b5ab5fecdd258b7ec6927fa5498f343 Mon Sep 17 00:00:00 2001 From: Huu Le <20178761+huult@users.noreply.github.com> Date: Mon, 14 Jul 2025 09:50:48 +0700 Subject: [PATCH 3/3] fix error message --- src/libs/actions/BankAccounts.ts | 12 ++---------- src/pages/settings/Wallet/WalletPage/WalletPage.tsx | 12 ++++++++++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index e4a21474c88d5..32fdece3354e8 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -29,7 +29,7 @@ import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; import type {InternationalBankAccountForm, PersonalBankAccountForm} from '@src/types/form'; import type {ACHContractStepProps, BeneficialOwnersStepProps, CompanyStepProps, ReimbursementAccountForm, RequestorStepProps} from '@src/types/form/ReimbursementAccountForm'; -import type {BankAccountList, LastPaymentMethod, LastPaymentMethodType} from '@src/types/onyx'; +import type {LastPaymentMethod, LastPaymentMethodType, PersonalBankAccount} from '@src/types/onyx'; import type PlaidBankAccount from '@src/types/onyx/PlaidBankAccount'; import type {BankAccountStep, ReimbursementAccountStep, ReimbursementAccountSubStep} from '@src/types/onyx/ReimbursementAccount'; import type {OnyxData} from '@src/types/onyx/Request'; @@ -52,13 +52,6 @@ export {openOnfidoFlow, answerQuestionsForWallet, verifyIdentity, acceptWalletTe type AccountFormValues = typeof ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT_FORM | typeof ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM; -let bankAccountList: OnyxEntry; - -Onyx.connect({ - key: ONYXKEYS.BANK_ACCOUNT_LIST, - callback: (value) => (bankAccountList = value), -}); - function clearPlaid(): Promise { Onyx.set(ONYXKEYS.PLAID_LINK_TOKEN, ''); Onyx.set(ONYXKEYS.PLAID_CURRENT_EVENT, null); @@ -336,9 +329,8 @@ function addPersonalBankAccount(account: PlaidBankAccount, policyID?: string, so API.write(WRITE_COMMANDS.ADD_PERSONAL_BANK_ACCOUNT, parameters, onyxData); } -function deletePaymentBankAccount(bankAccountID: number, lastUsedPaymentMethods?: LastPaymentMethod) { +function deletePaymentBankAccount(bankAccountID: number, lastUsedPaymentMethods?: LastPaymentMethod, bankAccount?: OnyxEntry) { const parameters: DeletePaymentBankAccountParams = {bankAccountID}; - const bankAccount = bankAccountList ? bankAccountList[bankAccountID] : undefined; const bankAccountFailureData = { ...bankAccount, diff --git a/src/pages/settings/Wallet/WalletPage/WalletPage.tsx b/src/pages/settings/Wallet/WalletPage/WalletPage.tsx index ab224114a0016..2fbd76c509ab6 100644 --- a/src/pages/settings/Wallet/WalletPage/WalletPage.tsx +++ b/src/pages/settings/Wallet/WalletPage/WalletPage.tsx @@ -295,11 +295,19 @@ function WalletPage({shouldListenForResize = false}: WalletPageProps) { const bankAccountID = paymentMethod.selectedPaymentMethod.bankAccountID; const fundID = paymentMethod.selectedPaymentMethod.fundID; if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && bankAccountID) { - deletePaymentBankAccount(bankAccountID, lastUsedPaymentMethods); + const bankAccount = bankAccountList?.[paymentMethod.methodID] ?? {}; + deletePaymentBankAccount(bankAccountID, lastUsedPaymentMethods, bankAccount); } else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD && fundID) { deletePaymentCard(fundID); } - }, [paymentMethod.selectedPaymentMethod.bankAccountID, paymentMethod.selectedPaymentMethod.fundID, paymentMethod.selectedPaymentMethodType, lastUsedPaymentMethods]); + }, [ + paymentMethod.selectedPaymentMethod.bankAccountID, + paymentMethod.selectedPaymentMethod.fundID, + paymentMethod.selectedPaymentMethodType, + paymentMethod.methodID, + bankAccountList, + lastUsedPaymentMethods, + ]); /** * Navigate to the appropriate page after completing the KYC flow, depending on what initiated it