-
Notifications
You must be signed in to change notification settings - Fork 4k
feat: Reset non USD flow #58100
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
Merged
madmax330
merged 12 commits into
Expensify:main
from
callstack-internal:feat/58091-reset-non-usd-flow
Mar 19, 2025
Merged
feat: Reset non USD flow #58100
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d30df12
feat: Reset non USD flow
MrMuzyk c2574b7
handle disconnect scenario
MrMuzyk 5459be8
Merge branch 'main' of https://github.com/Expensify/App into feat/580…
MrMuzyk 9ae5414
Merge branch 'main' of https://github.com/Expensify/App into feat/580…
MrMuzyk b783377
resolve missing country after reset issue
MrMuzyk a4d3f60
Merge branch 'main' of https://github.com/Expensify/App into feat/580…
MrMuzyk 48b8d1c
lint
MrMuzyk 7194af5
Merge branch 'main' of https://github.com/Expensify/App into feat/580…
MrMuzyk 67d4e2c
condition to continue screen
MrMuzyk cfd5244
fix: cr fixes
MrMuzyk f4eb1b5
fix: remove log
MrMuzyk 2cc1368
fix: pass policy ID
MrMuzyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| type ResetBankAccountSetupParams = { | ||
| policyID: string | undefined; | ||
| }; | ||
|
|
||
| export default ResetBankAccountSetupParams; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/libs/actions/ReimbursementAccount/resetNonUSDBankAccount.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import Onyx from 'react-native-onyx'; | ||
| import type {OnyxCollection} from 'react-native-onyx'; | ||
| import * as API from '@libs/API'; | ||
| import {WRITE_COMMANDS} from '@libs/API/types'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type * as OnyxTypes from '@src/types/onyx'; | ||
|
|
||
| let allPolicies: OnyxCollection<OnyxTypes.Policy>; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.POLICY, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => (allPolicies = value), | ||
| }); | ||
|
|
||
| function resetNonUSDBankAccount(policyID: string | undefined) { | ||
| if (!policyID) { | ||
| throw new Error('Missing Policy ID when attempting to reset'); | ||
| } | ||
|
|
||
| const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`] ?? ({} as OnyxTypes.Policy); | ||
|
|
||
| API.write( | ||
| WRITE_COMMANDS.RESET_BANK_ACCOUNT_SETUP, | ||
| {policyID}, | ||
| { | ||
| optimisticData: [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
| value: { | ||
| shouldShowResetModal: false, | ||
| isLoading: true, | ||
| pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, | ||
| achData: null, | ||
| }, | ||
| }, | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, | ||
| value: { | ||
| achAccount: null, | ||
| }, | ||
| }, | ||
| ], | ||
| successData: [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.SET, | ||
| key: ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT, | ||
| value: null, | ||
| }, | ||
| { | ||
| onyxMethod: Onyx.METHOD.SET, | ||
| key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
| value: CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA, | ||
| }, | ||
| ], | ||
| failureData: [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
| value: {isLoading: false, pendingAction: null}, | ||
| }, | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, | ||
| value: { | ||
| achAccount: policy?.achAccount, | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| export default resetNonUSDBankAccount; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.