-
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
Add Personal Bank Account via Plaid flow #2746
Conversation
@@ -10,7 +10,7 @@ | |||
# Specifies the JVM arguments used for the daemon process. | |||
# The setting is particularly useful for tweaking memory settings. | |||
# Default value: -Xmx10248m -XX:MaxPermSize=256m | |||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | |||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 |
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.
This seems necessary after adding the Plaid SDK there's some more information here about this:
https://medium.com/google-developers/faster-android-studio-builds-with-dex-in-process-5988ed8aa37e
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.
TL;DR is that without this enabled the android app wouldn't build at all.
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.
What version of the JDK do we target? MaxPermSize
was removed in JDK 8 so that param might not do anything
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.
JDK 8 I believe, I don't know much about Java though I just uncommented this line out based on the advice in that blog post.
add the add bank account page Add PlaidLink on web and ability to add bank account add react plaid link library derp revert plist changes Add Android configs Add secure NGROK option add note about dependency add secure ngrok option temp disable flipper add nativeModules files Fix up propTypes Use React.Fragment add translation stuff add comments add doc
c4ec957
to
99ded8c
Compare
@francoisl this PR is kind of huge so going to add a couple more reviewers to it 😄 |
ios/Podfile
Outdated
post_install do |installer| | ||
flipper_post_install(installer) | ||
# flipper_post_install(installer) |
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.
Oops forgot to remove this guy. It needed so that iOS will build on dev for now. 🙃
@@ -3,7 +3,7 @@ | |||
buildscript { | |||
ext { | |||
buildToolsVersion = "29.0.2" | |||
minSdkVersion = 16 | |||
minSdkVersion = 21 |
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.
This appears to be a requirement in order to use the Plaid SDK on Android
https://github.com/plaid/react-native-plaid-link-sdk#3-configure-gradle
I'm hoping it's OK ? @Jag96
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.
We talked about doing this a while back but this is definitely fine, the issue is here: https://github.com/Expensify/Expensify/issues/149395
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.
Oh nice!
props.onSuccess({publicToken, metadata}); | ||
}, []); | ||
|
||
const {open, ready, error} = usePlaidLink({ |
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.
We normally should not need to use hooks (and kind of discourage it), but the Plaid library we're using for React web here really only offers this option to launch the flow programmatically.
src/libs/actions/BankAccounts.js
Outdated
currency: 'USD', | ||
fieldsType: 'local', | ||
plaidAccessToken, | ||
isForStripeConnect: false, |
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.
@ctkochan22 wondering if you can help us figure out whether we need all of this stuff. I loosely based these parameters on what we send when adding a PBA on e.com.
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.
Don't need isForStripeConnect
. The rest are necessary I think. But when it comes to additionalData, more info is always good I think. What you have now is good.
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.
Looks good, a lot of it is over my head though. Still trying to test but I think my .env file is messed up and causing me errors, going to look into that.
@@ -10,7 +10,7 @@ | |||
# Specifies the JVM arguments used for the daemon process. | |||
# The setting is particularly useful for tweaking memory settings. | |||
# Default value: -Xmx10248m -XX:MaxPermSize=256m | |||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | |||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 |
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.
What version of the JDK do we target? MaxPermSize
was removed in JDK 8 so that param might not do anything
} | ||
|
||
/** | ||
* Get list of bank accounts |
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.
Curious why this method gets a doc but not the one below?
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.
Only because it has a return value. I think at one point we were enforcing method docs but now only making them if there is a param or return that needs to be documented or some additional comments.
Conflicts |
Updated and fixed the conflicts. |
@shawnborton I was thinking we could do styling stuff in a follow up with a contributor if that works for ya. Mostly just trying to scaffold some stuff out here. |
Cool, that works for me. Though it is a bit strange that our default component wouldn't have the default font/color baked into it? But yeah, we can investigate that elsewhere. |
src/CONFIG.js
Outdated
|
||
// Throw errors on dev if config variables are not set correctly | ||
if (ENVIRONMENT === CONST.ENVIRONMENT.DEV) { | ||
if (!useNgrok && expensifyURL.endsWith('dev') && !expensifyURLSecure.endsWith('dev')) { |
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.
In my .env file, I have a trailing slash for both the EXPENSIFY_URL_COM
and the EXPENSIFY_URL_SECURE
values, so this logic doesn't throw the error if I have EXPENSIFY_URL_COM=https://www.expensify.com.dev/
and EXPENSIFY_URL_SECURE=https://secure.expensify.com/
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.
🤦 fixed this up and changed it to an String.includes()
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.
Looks great
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.
There's a conflict
4d18304
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@Jag96 Heyo! Will this be internally tested? Let me know so we can check it of the list. 🙇 |
This should be QA testable. With the exception of desktop since there are no deep links. |
I'm happy to takeover the testing for this. I think I intended it to be Internal just because of how weird it is. |
Web is working fine 🎉 I think no need to block on this as long as the rest of the app works. Nothing is using the flow yet. |
Oh hmm I think judging from logs the native Android app is not using the staging server... cc @roryabraham to confirm. |
Probably we will need to test this on production anyway to be sure it works - I think it will, but I don't have an account to test with as my bank is not an option in Plaid. |
@marcaaron Are you asking if the E.cash Android beta (staging) app communicates with the staging API? If so, the answer is no – E.cash staging only communicates with the production API, by design. There was a fair amount of discussion around this already, but basically the reason is that if E.cash staging can't talk to our staging API, then there's no chance we deploy code that breaks E.cash production because it is dependent upon a staging API which has not yet been deployed. |
Let me ask another way... 😅 https://staging.expensify.cash appears to use the |
Ah, yes that's true. The reason for that is because when we run an iOS/Android deploy we just take an existing beta build and release it for production. |
Got it! Thanks for the context. I think this will need to be |
|
||
useEffect(() => { | ||
if (error) { | ||
props.onError(error); |
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.
This usage leads to #38069. This happened due to a change in onError
on each re-render as it wasn't memoized.
Details
This issue is sort of holding on https://github.com/Expensify/Expensify/issues/163233 where we'll add the Android app package name to the Plaid dashboard. I don't have the access level to do this so until that is done Android cannot be tested on production - but should be testable on dev and staging which are both using the sandbox.This is done now so we can test on release builds.Fixed Issues
Fixes https://github.com/Expensify/Expensify/issues/161736
Fixes https://github.com/Expensify/Expensify/issues/149395
Notes on testing this on native platforms
This flow is only accessible via deep link at the moment so we'll need to follow instructions here
If you are using ngrok on iOS simulator make sure you also have certs on your simulator device. I wasted some time trying to figure out why iOS couldn't call secure.
Notes on testing on Android
In order to access local web-secure on Android it's necessary to create a separate endpoint for web-secure. I created a whole new one by following instructions here but a temporary one should work too.
After setting up a new "secure" ngrok url to use I ran this and everything worked fine.
ngrok http -hostname=secure-expensify-marc.ngrok.io --host-header rewrite secure.expensify.com.dev:443
Tests
/add-bank-account
user_good
/pass_good
expensify.com.dev
that the account has been addedQA Steps (Internal)
QA is largely the same for staging. Making it internal because it may be tricky to get the deep links to work.
I can also do the QA for this (or help out) if whoever is assigned asks.
Tested On
Screenshots
Web
Mobile Web
Desktop
N/A
iOS
Android