-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[No QA] Card settings page #45415
[No QA] Card settings page #45415
Changes from 19 commits
222f339
df5c63a
3061716
b86b49e
9ad8395
05f5ae8
c8d83f6
640e883
982795f
3be64f9
15a4d3c
760be43
d10c084
3f70bff
b10bae6
0c4ab59
28f4e49
6ff1005
9d3658a
7a5306e
423bc0d
4c7c53b
0d40c8c
9ccc526
08097f7
b0fc7c7
ade4696
8573725
aabc037
e31a945
5f0f41f
4965c6a
5fa6164
eb2323b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,5 +5,12 @@ import type * as OnyxTypes from '@src/types/onyx'; | |||||||||||||||||||
function getDefaultCompanyWebsite(session: OnyxEntry<OnyxTypes.Session>, user: OnyxEntry<OnyxTypes.User>): string { | ||||||||||||||||||||
return user?.isFromPublicDomain ? 'https://' : `https://www.${Str.extractEmailDomain(session?.email ?? '')}`; | ||||||||||||||||||||
} | ||||||||||||||||||||
// eslint-disable-next-line import/prefer-default-export | ||||||||||||||||||||
export {getDefaultCompanyWebsite}; | ||||||||||||||||||||
|
||||||||||||||||||||
function getLastFourDigits(bankAccountNumber: string): string { | ||||||||||||||||||||
if (!bankAccountNumber) { | ||||||||||||||||||||
return ''; | ||||||||||||||||||||
} | ||||||||||||||||||||
return bankAccountNumber.slice(-4); | ||||||||||||||||||||
} | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Can't we rewrite this something like the above? |
||||||||||||||||||||
|
||||||||||||||||||||
export {getDefaultCompanyWebsite, getLastFourDigits}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ import CONST from '@src/CONST'; | |
import type {TranslationPaths} from '@src/languages/types'; | ||
import type {OnyxValues} from '@src/ONYXKEYS'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {Card, CardList} from '@src/types/onyx'; | ||
import type {BankAccountList, Card, CardList} from '@src/types/onyx'; | ||
import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
import * as Localize from './Localize'; | ||
|
||
let allCards: OnyxValues[typeof ONYXKEYS.CARD_LIST] = {}; | ||
|
@@ -158,6 +159,14 @@ function getTranslationKeyForLimitType(limitType: ValueOf<typeof CONST.EXPENSIFY | |
} | ||
} | ||
|
||
function getEligibleBankAccountsForCard(bankAccountsList: OnyxEntry<BankAccountList>) { | ||
if (!bankAccountsList || isEmptyObject(bankAccountsList)) { | ||
return []; | ||
} | ||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ | ||
return Object.values(bankAccountsList).filter((bankAccount) => bankAccount?.accountData?.allowDebit || bankAccount?.accountData?.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if allowDebit would be false it would return false and wouldn't check for the type. We could have false for allowDebit but type would be fine, but we would get false incorrectly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we get around this? I believe that any eslnt rule disable means that react-compiler does not process this file, we should try to avoid adding any eslint-disable to new code |
||
} | ||
|
||
export { | ||
isExpensifyCard, | ||
isCorporateCard, | ||
|
@@ -171,4 +180,5 @@ export { | |
hasDetectedFraud, | ||
getMCardNumberString, | ||
getTranslationKeyForLimitType, | ||
getEligibleBankAccountsForCard, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MariaHCD @mountiny - just to make sure, sharedNVP_expensifyCard_continuousReconciliationConnection_ should store connection name, not the bank account data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sharedNVP_expensifyCard_continuousReconciliationConnection_ will just store the name of the connection like
quickbooksOnline
,xero
,netsuite
orintacct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks! So it's now fixed in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not related but just for info, is that an
array
? can we have multiple connections at once?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will just be a string. I believe it's only one connection at a time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, thanks