Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP-stag] Do not check for defaultCredit #29915

Merged
merged 5 commits into from
Oct 20, 2023
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
5 changes: 3 additions & 2 deletions src/libs/PaymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, Fund>, bankAccountList: Record<string, BankAccount>, 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
Expand Down
8 changes: 6 additions & 2 deletions src/libs/models/BankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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';
}

Expand Down
Loading