diff --git a/src/libs/PaymentUtils.ts b/src/libs/PaymentUtils.ts index 90ec2b3ccc52..3057ecf2ef60 100644 --- a/src/libs/PaymentUtils.ts +++ b/src/libs/PaymentUtils.ts @@ -9,12 +9,13 @@ import PaymentMethod from '../types/onyx/PaymentMethod'; type AccountType = BankAccount['accountType'] | Fund['accountType']; /** - * Check to see if user has either a debit card or personal bank account added + * Check to see if user has either a debit card or personal bank account added that can be used with a wallet. */ function hasExpensifyPaymentMethod(fundList: Record, bankAccountList: Record, shouldIncludeDebitCard = true): boolean { const validBankAccount = Object.values(bankAccountList).some((bankAccountJSON) => { const bankAccount = new BankAccountModel(bankAccountJSON); - return bankAccount.getPendingAction() !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && bankAccount.isDefaultCredit(); + + return bankAccount.getPendingAction() !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && bankAccount.isOpen() && bankAccount.getType() === CONST.BANK_ACCOUNT.TYPE.PERSONAL; }); // Hide any billing cards that are not P2P debit cards for now because you cannot make them your default method, or delete them diff --git a/src/libs/models/BankAccount.js b/src/libs/models/BankAccount.js index ec75e92ab27e..faf4cbad34e5 100644 --- a/src/libs/models/BankAccount.js +++ b/src/libs/models/BankAccount.js @@ -139,6 +139,10 @@ class BankAccount { return this.json.accountData.allowDebit === true; } + getType() { + return this.json.accountData.type; + } + /** * Return the client ID of this bank account * @@ -147,14 +151,14 @@ class BankAccount { */ getClientID() { // eslint-disable-next-line max-len - return `${Str.makeID(this.getMaskedAccountNumber())}${Str.makeID(this.getAddressName())}${Str.makeID(this.getRoutingNumber())}${this.getType()}`; + return `${Str.makeID(this.getMaskedAccountNumber())}${Str.makeID(this.getAddressName())}${Str.makeID(this.getRoutingNumber())}${this.getTransactionType()}`; } /** * @returns {String} * @private */ - getType() { + getTransactionType() { return this.isWithdrawal() ? 'withdrawal' : 'direct-deposit'; }