-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Feat: Locked bank account #69159
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
base: main
Are you sure you want to change the base?
Feat: Locked bank account #69159
Changes from all commits
804302b
a88a70c
a9ad749
646de8e
5334e39
e433735
b7b358b
be895d1
20bf3e5
a20186a
51d6eff
f9041a9
cd64b0d
76ee8d6
cfc1086
58ef1d5
ceda834
71dc8ee
1a3cca1
886eb35
14a9399
1dce1ed
197864f
2f627fa
bff67b0
4c86fb7
3cae581
a222d23
cd0ea29
de5ce0e
80d274d
8fb2d53
9f9fc06
be0cc31
41b23e5
7dc618a
47498be
0c15685
f0fe86f
1f1bed0
008c96a
864da8b
de2a1ad
114b736
09aa922
63c50d7
a5a9e92
6d8c433
a97b736
ed9d417
e363262
b15a80f
9740d75
d7f0a99
d88f17e
6c9e140
f291d43
fe021b9
bb5ab98
da7e11b
5b468e9
8ddf9af
8f919a2
8f1393f
467b294
18c0db1
0de39f9
1410703
3b1f63d
4e32870
1192ec0
de07045
b39063a
43ece19
037cfe9
1d1a33d
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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import {useEffect} from 'react'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import {isConciergeChatReport} from '@libs/ReportUtils'; | ||
| import {initiateBankAccountUnlock} from '@userActions/BankAccounts'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {Report} from '@src/types/onyx'; | ||
| import useOnyx from './useOnyx'; | ||
|
|
||
| function useBankAccountUnlockEffect(report: OnyxEntry<Report> | undefined) { | ||
|
Contributor
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. I wonder why we need this hook. Can't we just call the API wherever
Contributor
Author
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. Few reasons, we need to set optimistic message, navigate user to the chat and avoid race condition and duplicated calls. |
||
| const [initiatingBankAccountUnlock] = useOnyx(ONYXKEYS.INITIATING_BANK_ACCOUNT_UNLOCK); | ||
| const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); | ||
|
|
||
| useEffect(() => { | ||
| if (!isConciergeChatReport(report) || !initiatingBankAccountUnlock?.bankAccountIDToUnlock) { | ||
| return; | ||
| } | ||
| initiateBankAccountUnlock(initiatingBankAccountUnlock.bankAccountIDToUnlock, conciergeReportID ?? undefined, initiatingBankAccountUnlock.optimisticReportActionID); | ||
| // We only want to re-fire when reportID changes, not on every report field update | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [initiatingBankAccountUnlock?.bankAccountIDToUnlock, report?.reportID]); | ||
| } | ||
|
|
||
| export default useBankAccountUnlockEffect; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,7 @@ function useNavigationTabBarIndicatorChecks(): NavigationTabBarChecksResult { | |
| [CONST.INDICATOR_STATUS.HAS_WALLET_TERMS_ERRORS]: Object.keys(walletTerms?.errors ?? {}).length > 0 && !walletTerms?.chatReportID, | ||
| [CONST.INDICATOR_STATUS.HAS_PHONE_NUMBER_ERROR]: !!privatePersonalDetails?.errorFields?.phoneNumber, | ||
| [CONST.INDICATOR_STATUS.HAS_EMPLOYEE_CARD_FEED_ERRORS]: !isPolicyAdmin ? hasCompanyCardFeedErrors : false, | ||
| [CONST.INDICATOR_STATUS.HAS_LOCKED_BANK_ACCOUNT]: Object.values(bankAccountList ?? {}).some((bankAccount) => bankAccount?.accountData?.state === CONST.BANK_ACCOUNT.STATE.LOCKED), | ||
|
Contributor
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. Let's update unit test for this new error in |
||
| }; | ||
|
|
||
| const infoChecks: Partial<Record<IndicatorStatus, boolean>> = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
BUG(Minor)
Let's add the message for this error in the debug tool here and here. Currently it shows nothing: