-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[#Wave-Control: Add NetSuite]: Top-level Subsidiary selection #44038
Merged
yuwenmemon
merged 59 commits into
Expensify:main
from
mananjadhav:mj-netsuite-subsidiary-select
Jun 25, 2024
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
747fe19
Revert "Merge pull request #42965 from suneox/40767-handle-edit-last-…
mananjadhav 8c0912a
Reapply "Merge pull request #42965 from suneox/40767-handle-edit-last…
mananjadhav 2ab267e
Merge branch 'main' of github.com:mananjadhav/App
mananjadhav b335e64
Merge branch 'main' of github.com:mananjadhav/App
mananjadhav e8c4fb5
Merge branch 'main' of github.com:mananjadhav/App
mananjadhav 5224cb9
feat: net suite setup
mananjadhav f288173
feat: navigation types
mananjadhav b51c85a
feat: page setup with options
mananjadhav 95089ff
fix: default selection
mananjadhav 424495d
fix: routing
mananjadhav c8185c8
feat: show selected subsidiary
mananjadhav 007d762
style: lint fixes
mananjadhav 577dc58
refactor: remove console.log
mananjadhav 68c865c
feat: added write command
mananjadhav 855c930
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav 2a4add9
refactor: rename type
mananjadhav 4461ff2
refactor: lint fixes
mananjadhav 6fc7b09
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav 88ec924
feat: added icon and es content
mananjadhav d563a73
fix: added fallback
mananjadhav 208b4b9
refactor: rename net_suite identifier
mananjadhav bd7973a
feat: added api types
mananjadhav 0faf015
feat: modify optimistic data
mananjadhav d66f59d
feat: added api call
mananjadhav 0664aa6
fix: param name
mananjadhav 8fa3a78
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav 8c1c8d6
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav f7252bb
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav c47d6de
refactor: update id handling
mananjadhav ada6d00
fix: added id in params
mananjadhav a172a5b
fix: added comment
mananjadhav f81860b
fix: added pending action
mananjadhav bc1365d
fix: added error handling
mananjadhav 26903ce
style: lint fixes
mananjadhav 5a6bf06
feat: nested scrollview handling
mananjadhav 521b93e
style: lint fixes
mananjadhav dd3d8a5
refactor: error handling
mananjadhav f8865bf
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav aeba073
style: lint fixes
mananjadhav 9b77ae8
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav baf05f2
refactor: use withpolicyconnections
mananjadhav c71d566
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav 0116857
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav 66159f1
refactor: update args for error field
mananjadhav 414b116
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-su…
mananjadhav d2666d8
refactor: rename imports and files
mananjadhav 1132bb0
fix: go back
mananjadhav 16ee3e2
refactor: run prettier
mananjadhav 0bb8d5a
refactor: use selectionscreen
mananjadhav a977826
refactor: api call fixes
mananjadhav 0fe7e06
refactor: import lint error
mananjadhav ac62d2f
refactor: rename methods and error conditions
mananjadhav e1f9e11
fix: Spanish translation
mananjadhav e0b782a
refactor: added fallback
mananjadhav bb8f94b
fix: rollback unwanted prop
mananjadhav 2a9b743
fix: remove extra space
mananjadhav 6be111f
fix: netsuite name
mananjadhav 01cac87
refactor: remove unwanted types
mananjadhav fc16c01
fix: lint errors
mananjadhav 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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 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 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 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,7 @@ | ||
type UpdateNetSuiteSubsidiaryParams = { | ||
policyID: string; | ||
subsidiary: string; | ||
subsidiaryID: string; | ||
}; | ||
|
||
export default UpdateNetSuiteSubsidiaryParams; |
This file contains 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 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 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 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 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 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 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 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,99 @@ | ||
import Onyx from 'react-native-onyx'; | ||
import * as API from '@libs/API'; | ||
import {WRITE_COMMANDS} from '@libs/API/types'; | ||
import * as ErrorUtils from '@libs/ErrorUtils'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {OnyxData} from '@src/types/onyx/Request'; | ||
|
||
type SubsidiaryParam = { | ||
subsidiaryID: string; | ||
subsidiary: string; | ||
}; | ||
|
||
function updateNetSuiteSubsidiary(policyID: string, newSubsidiary: SubsidiaryParam, oldSubsidiary: SubsidiaryParam) { | ||
const onyxData: OnyxData = { | ||
optimisticData: [ | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, | ||
value: { | ||
connections: { | ||
netsuite: { | ||
options: { | ||
config: { | ||
subsidiary: newSubsidiary.subsidiary, | ||
subsidiaryID: newSubsidiary.subsidiaryID, | ||
pendingFields: { | ||
subsidiary: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, | ||
}, | ||
errorFields: { | ||
subsidiary: null, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
successData: [ | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, | ||
value: { | ||
connections: { | ||
netsuite: { | ||
options: { | ||
config: { | ||
subsidiary: newSubsidiary.subsidiary, | ||
subsidiaryID: newSubsidiary.subsidiaryID, | ||
errorFields: { | ||
subsidiary: null, | ||
}, | ||
pendingFields: { | ||
subsidiary: null, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
failureData: [ | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, | ||
value: { | ||
connections: { | ||
netsuite: { | ||
options: { | ||
config: { | ||
subsidiary: oldSubsidiary.subsidiary, | ||
subsidiaryID: oldSubsidiary.subsidiaryID, | ||
errorFields: { | ||
subsidiary: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'), | ||
}, | ||
pendingFields: { | ||
subsidiary: null, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
const params = { | ||
policyID, | ||
...newSubsidiary, | ||
}; | ||
API.write(WRITE_COMMANDS.UPDATE_NETSUITE_SUBSIDIARY, params, onyxData); | ||
} | ||
|
||
// We'll have more API calls in upcoming PRs | ||
// eslint-disable-next-line import/prefer-default-export | ||
export {updateNetSuiteSubsidiary}; |
Oops, something went wrong.
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.
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.
You forgot to pass authToken here.
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.
I don't think it's necessary to pass
authToken
.