Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2680,6 +2680,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: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2676,6 +2676,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: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2665,6 +2665,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: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,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: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,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: {
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2700,6 +2700,7 @@ const translations = {
validationAmounts: '入力された検証金額が正しくありません。銀行の明細をもう一度確認して、再試行してください。',
fullName: '有効なフルネームを入力してください',
ownershipPercentage: '有効なパーセンテージの数字を入力してください',
deletePaymentBankAccount: 'この銀行口座はExpensifyカードの支払いに使用されているため、削除できません。それでもこの口座を削除したい場合は、コンシェルジュにお問い合わせください。',
},
},
addPersonalBankAccount: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,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: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,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: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2697,6 +2697,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: {
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2669,6 +2669,7 @@ const translations = {
validationAmounts: '您输入的验证金额不正确。请仔细检查您的银行对账单,然后重试。',
fullName: '请输入有效的全名',
ownershipPercentage: '请输入一个有效的百分比数字',
deletePaymentBankAccount: '由于该银行账户用于Expensify卡支付,因此无法删除。如果您仍希望删除此账户,请联系Concierge。',
},
},
addPersonalBankAccount: {
Expand Down
20 changes: 19 additions & 1 deletion src/libs/actions/BankAccounts.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 {LastPaymentMethod, 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';
Expand Down Expand Up @@ -285,9 +287,15 @@ function addPersonalBankAccount(account: PlaidBankAccount, policyID?: string, so
API.write(WRITE_COMMANDS.ADD_PERSONAL_BANK_ACCOUNT, parameters, onyxData);
}

function deletePaymentBankAccount(bankAccountID: number) {
function deletePaymentBankAccount(bankAccountID: number, lastUsedPaymentMethods?: LastPaymentMethod, bankAccount?: OnyxEntry<PersonalBankAccount>) {
const parameters: DeletePaymentBankAccountParams = {bankAccountID};

const bankAccountFailureData = {
...bankAccount,
errors: getMicroSecondOnyxErrorWithTranslationKey('bankAccount.error.deletePaymentBankAccount'),
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
};

const onyxData: OnyxData = {
optimisticData: [
{
Expand All @@ -306,6 +314,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);
Expand Down
5 changes: 3 additions & 2 deletions src/pages/settings/Wallet/WalletPage/WalletPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,12 @@ 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);
const bankAccount = bankAccountList?.[paymentMethod.methodID] ?? {};
deletePaymentBankAccount(bankAccountID, undefined, bankAccount);
} else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD && fundID) {
deletePaymentCard(fundID);
}
}, [paymentMethod.selectedPaymentMethod.bankAccountID, paymentMethod.selectedPaymentMethod.fundID, paymentMethod.selectedPaymentMethodType]);
}, [paymentMethod.selectedPaymentMethod.bankAccountID, paymentMethod.selectedPaymentMethod.fundID, paymentMethod.selectedPaymentMethodType, paymentMethod.methodID, bankAccountList]);

/**
* Navigate to the appropriate page after completing the KYC flow, depending on what initiated it
Expand Down
Loading