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

[PlaidLink OAuth] Add web redirect_uri to /bank-accounts page #6259

Merged
merged 73 commits into from
Dec 3, 2021
Merged
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
3768247
Initial testing
Nov 4, 2021
ecabb8a
Add new redirectURI param for plaidLinkToken call
Nov 4, 2021
6a7fac8
Update redirectURI param
Nov 4, 2021
7486623
Add redirect new.e page
Nov 5, 2021
b9df300
Hook up OAuth redirect with onyx plaidLinkToken
Nov 5, 2021
80c3ae0
Testing redirect_uri
Nov 7, 2021
319cd00
Add redirect PLAID route
Nov 7, 2021
a545977
Hook up OAuth to modalStack
Nov 7, 2021
a6ca4fb
Switch out PlaidLink with OAuthLink
Nov 7, 2021
c643221
Add redirect screen separate from settings
Nov 8, 2021
727a1ca
Add OAuth to AuthScreens
Nov 8, 2021
d072bc5
OAuth works using platypus oauth account
Nov 8, 2021
9709dbf
Make statedID work within addplaidbankaccount
Nov 8, 2021
3d758fc
Work with current plaidLink page
Nov 8, 2021
e9894d2
Setup new page with OAuthLink
Nov 9, 2021
1dd666f
Fill out PlaidOAuthPage
Nov 9, 2021
c50afb8
Finish attaching props to new PlaidRedirect page
Nov 9, 2021
1413ad4
Setup to reuse AddPlaidBankAccount
Nov 9, 2021
6587c11
Things work now
Nov 9, 2021
03437e6
Clean up logs
Nov 9, 2021
40523d3
Mass cleanup
Nov 9, 2021
e474ff1
Delete unneeded files
Nov 9, 2021
cf3e88a
Fix comment
Nov 9, 2021
5f1f635
Figure out variables for getting bank account
Nov 9, 2021
8644b35
Merge branch 'main' into nmurray-plaidlink-oauth-update
Nov 9, 2021
1578e17
Add no stateID error handling
Nov 9, 2021
66db02b
Fill out propType doc
Nov 9, 2021
c160146
Lint
Nov 9, 2021
87e5b2b
Test setting up new withdrawal bank account
Nov 10, 2021
3ec2790
Cleanup comments
Nov 10, 2021
7142e44
Lint
Nov 10, 2021
84e2a4f
Minor PR comments
Nov 10, 2021
aebd05c
Separate file extension specific platform
Nov 10, 2021
63e110a
Add propTypes file
Nov 10, 2021
673e3ce
Fill out native addPlaidBank
Nov 10, 2021
0b9522b
Setup using two different endpoints
Nov 10, 2021
750c159
Works with two different endpoints
Nov 10, 2021
a6f5c94
Lint and get adding bank account working
Nov 10, 2021
3702457
Delete onyx key
Nov 10, 2021
326b948
Testing navigation bug
Nov 13, 2021
9f51191
Improvement to redirectURI
Nov 13, 2021
71accec
try to switch over to using ReimbursementPage as base component for P…
Nov 19, 2021
01dad51
Cleanup, going from selecting account to CompanyStep works now
Nov 19, 2021
e2c4c99
Fix error where substep returns null and makes us go back to BankAcco…
Nov 19, 2021
72ff541
Revert BankAccountStep external setupBankAccount method
Nov 19, 2021
a254c03
Switch over to just using ReimbursementPage instead of new OAuthPlaid…
Nov 23, 2021
9ae9461
Add getOAuthReceivedRedirectURI and add it to Personal Bank Account Page
Nov 23, 2021
1d50056
Revert old changes
Nov 23, 2021
fc1095a
More cleanup
Nov 23, 2021
791dc61
Cleanup redirect URI logic and fix IdentityForm address error
Nov 23, 2021
3314dc4
Hook up BaseAddPlaidPage and delete old OAuthPlaidPage
Nov 23, 2021
2622ce5
Revert platform extensions
Nov 24, 2021
91b3238
Merge branch 'main' into nmurray-plaidlink-oauth-update
Nov 24, 2021
add0815
Fix lint warnings
Nov 24, 2021
fcf15e6
Include early return
Nov 24, 2021
842fb77
Variable name cleanup and comments
Nov 24, 2021
89d1b8e
Merge marc branch and fix conflicts
Nov 26, 2021
dfd9d7a
Test on web, desktop with complete uri
Nov 26, 2021
6798c11
Fix CONST.js conflicts
Nov 26, 2021
7c1be4f
Removed getRedirect logic out of AddPlaid, cleaned up src/libs/getPla…
Nov 26, 2021
07a0f6e
Clean up BankAccounts.js
Nov 26, 2021
e792b0c
Fix Url import
Nov 26, 2021
6842a47
Reduce condition to only using existing plaidLinkToken
Nov 29, 2021
6e68c70
Review comments, refactor existingPlaidToken prop
Nov 29, 2021
4f535b3
Merge branch 'main' into nmurray-plaidlink-oauth-update
Nov 29, 2021
3a8ac3a
Refactor ROUTE
Nov 29, 2021
36acde9
Fix export default
Nov 29, 2021
419d74e
Lint fix
Nov 29, 2021
51ec9c7
Second round of review comments
Nov 30, 2021
7d27703
Have addPersonalBankAccount subscribe to plaidLinkToken
Nov 30, 2021
34d2422
Update PlaidLink to check for receivedRedirectURI
Dec 2, 2021
5fa07db
Review comments and swap out CONST url for CONFIG url
Dec 3, 2021
44ff636
Merge with conflict
Dec 3, 2021
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
17 changes: 15 additions & 2 deletions src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class AddPlaidBankAccount extends React.Component {
super(props);

this.selectAccount = this.selectAccount.bind(this);
this.getPlaidLinkToken = this.getPlaidLinkToken.bind(this);

this.state = {
selectedIndex: undefined,
Expand Down Expand Up @@ -155,14 +156,26 @@ class AddPlaidBankAccount extends React.Component {
});
}

/**
* @returns {String}
*/
getPlaidLinkToken() {
if (!_.isEmpty(this.props.plaidLinkToken)) {
return this.props.plaidLinkToken;
}

if (this.props.receivedRedirectURI) {
return this.props.plaidLinkOAuthToken;
}
}

render() {
const accounts = this.getAccounts();
const options = _.map(accounts, (account, index) => ({
value: index, label: `${account.addressName} ${account.accountNumber}`,
}));
const {icon, iconSize} = getBankIcon(this.state.institution.name);
const hasPlaidLinkToken = !_.isEmpty(this.props.plaidLinkToken) || !_.isEmpty(this.props.plaidLinkOAuthToken);
const plaidLinkToken = !_.isEmpty(this.props.plaidLinkToken) ? this.props.plaidLinkToken : this.props.plaidLinkOAuthToken;

return (
<>
Expand All @@ -174,7 +187,7 @@ class AddPlaidBankAccount extends React.Component {
)}
{hasPlaidLinkToken && (
<PlaidLink
token={plaidLinkToken}
token={this.getPlaidLinkToken()}
onSuccess={({publicToken, metadata}) => {
Log.info('[PlaidLink] Success!');
BankAccounts.getPlaidBankAccounts(publicToken, metadata.institution.name);
Expand Down