Skip to content

Commit 3169df2

Browse files
committed
update translate error message bank account deletion spanish
1 parent 7ea0933 commit 3169df2

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/languages/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,8 @@ const translations = {
24172417
validationAmounts: 'The validation amounts you entered are incorrect. Please double check your bank statement and try again.',
24182418
fullName: 'Please enter a valid full name',
24192419
ownershipPercentage: 'Please enter a valid percentage number',
2420+
deletePaymentBankAccount:
2421+
"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.",
24202422
},
24212423
},
24222424
addPersonalBankAccount: {

src/languages/es.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,8 @@ const translations = {
24382438
validationAmounts: 'Los importes de validación que introduciste son incorrectos. Por favor, comprueba tu cuenta bancaria e inténtalo de nuevo.',
24392439
fullName: 'Por favor, introduce un nombre completo válido',
24402440
ownershipPercentage: 'Por favor, ingrese un número de porcentaje válido',
2441+
deletePaymentBankAccount:
2442+
'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.',
24412443
},
24422444
},
24432445
addPersonalBankAccount: {

src/libs/actions/BankAccounts.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type {OnyxEntry} from 'react-native-onyx';
12
import Onyx from 'react-native-onyx';
23
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
34
import type {OnfidoDataWithApplicantID} from '@components/Onfido/types';
@@ -26,6 +27,7 @@ import ROUTES from '@src/ROUTES';
2627
import type {Route} from '@src/ROUTES';
2728
import type {InternationalBankAccountForm, PersonalBankAccountForm} from '@src/types/form';
2829
import type {ACHContractStepProps, BeneficialOwnersStepProps, CompanyStepProps, ReimbursementAccountForm, RequestorStepProps} from '@src/types/form/ReimbursementAccountForm';
30+
import type {BankAccountList} from '@src/types/onyx';
2931
import type PlaidBankAccount from '@src/types/onyx/PlaidBankAccount';
3032
import type {BankAccountStep, ReimbursementAccountStep, ReimbursementAccountSubStep} from '@src/types/onyx/ReimbursementAccount';
3133
import type {OnyxData} from '@src/types/onyx/Request';
@@ -48,6 +50,13 @@ export {openOnfidoFlow, answerQuestionsForWallet, verifyIdentity, acceptWalletTe
4850

4951
type AccountFormValues = typeof ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT_FORM | typeof ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM;
5052

53+
let bankAccountList: OnyxEntry<BankAccountList>;
54+
55+
Onyx.connect({
56+
key: ONYXKEYS.BANK_ACCOUNT_LIST,
57+
callback: (value) => (bankAccountList = value),
58+
});
59+
5160
function clearPlaid(): Promise<void | void[]> {
5261
Onyx.set(ONYXKEYS.PLAID_LINK_TOKEN, '');
5362
Onyx.set(ONYXKEYS.PLAID_CURRENT_EVENT, null);
@@ -266,6 +275,13 @@ function addPersonalBankAccount(account: PlaidBankAccount, policyID?: string, so
266275

267276
function deletePaymentBankAccount(bankAccountID: number) {
268277
const parameters: DeletePaymentBankAccountParams = {bankAccountID};
278+
const bankAccount = bankAccountList ? bankAccountList[bankAccountID] : undefined;
279+
280+
const bankAccountFailureData = {
281+
...bankAccount,
282+
errors: getMicroSecondOnyxErrorWithTranslationKey('bankAccount.error.deletePaymentBankAccount'),
283+
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
284+
};
269285

270286
const onyxData: OnyxData = {
271287
optimisticData: [
@@ -285,6 +301,16 @@ function deletePaymentBankAccount(bankAccountID: number) {
285301
value: {[bankAccountID]: null},
286302
},
287303
],
304+
305+
failureData: [
306+
{
307+
onyxMethod: Onyx.METHOD.SET,
308+
key: `${ONYXKEYS.BANK_ACCOUNT_LIST}`,
309+
value: {
310+
[bankAccountID]: bankAccountFailureData,
311+
},
312+
},
313+
],
288314
};
289315

290316
API.write(WRITE_COMMANDS.DELETE_PAYMENT_BANK_ACCOUNT, parameters, onyxData);

0 commit comments

Comments
 (0)