feat(mobile): Plaid Link SDK cutover for Bridge external accounts [ENG-524]#668
Draft
islandbitcoin wants to merge 1 commit into
Draft
Conversation
…G-524] Match backend flash#446, which replaced the hosted Plaid linkUrl with a linkToken + server-side public_token exchange. - Add react-native-plaid-link-sdk (12.8.3, classic imperative API; no Expo dep). - Schema snapshot: BridgeExternalAccountLink gains linkToken; linkUrl is now nullable + @deprecated. Add bridgeExchangePlaidPublicToken mutation + input/ payload types. Regen codegen. - GraphQL docs: select linkToken in BridgeAddExternalAccount; add BridgeExchangePlaidPublicToken mutation. - TopupCashout.checkBridgeKyc: open Plaid Link with linkToken, then call bridgeExchangePlaidPublicToken({ linkToken, publicToken }) on success. The linked account arrives asynchronously via Bridge's webhook. - Additive fallback: no linkToken (older backend) -> existing linkUrl WebView; BRIDGE_PLAID_NOT_AVAILABLE -> manual bank entry (unchanged). - jest mock for the native SDK. Follow-ups: OAuth-bank redirect config (iOS associated domains + AppDelegate handler, Android intent-filter; needs a Plaid-dashboard redirect URI) and device/simulator verification. Do not merge before flash#446 ships. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Client side of backend PR lnflash/flash#446, which replaced the hosted Bridge Plaid
linkUrlwebview with the Plaid Link SDK + server-sidepublic_tokenexchange (the Api-Key never leaves the backend). Closes ENG-524.Backend contract after #446:
bridgeAddExternalAccountnow returnslinkToken: String!(+ existingexpiresAt);linkUrlis now nullable and@deprecated.bridgeExchangePlaidPublicToken(input: { linkToken, publicToken }): { errors, message }.BRIDGE_INVALID_PLAID_TOKEN,BRIDGE_PLAID_NOT_AVAILABLE.What changed
react-native-plaid-link-sdk@12.8.3— the last line with the classic imperativecreate()/open()API and no Expo-modules dependency (v13 is an Expo rewrite and would needexpo-modules-core, which this bare RN app doesn't have).app/graphql/public-schema.graphql):BridgeExternalAccountLinkgainslinkToken;linkUrl→ nullable +@deprecated. AddedBridgeExchangePlaidPublicTokenInput/…Payloadand thebridgeExchangePlaidPublicTokenmutation. Codegen regenerated (app/graphql/generated.ts/.gql).app/graphql/front-end-mutations.ts): selectlinkTokeninBridgeAddExternalAccount; add theBridgeExchangePlaidPublicTokenmutation.TopupCashout.tsx→checkBridgeKyc): open Plaid Link withlinkToken, then callbridgeExchangePlaidPublicToken({ linkToken, publicToken })ononSuccess. The external account is provisioned asynchronously via Bridge'sexternal_accountwebhook, so we refetch and inform the user it will appear shortly.linkTokenis returned (older backend), fall back to the existingBridgeExternalAccountWebViewonlinkUrl. TheBRIDGE_PLAID_NOT_AVAILABLE→ manual bank-entry path is unchanged.__mocks__/react-native-plaid-link-sdk.jsfor the native module.The pre-existing dirty
Gemfile/project.pbxproj/Podfile.lockin the working tree are not part of this PR.Verified locally
yarn tsc:check— clean.yarn check-code— tsc + translations +graphql-check(docs valid; the one "deprecated field" note is the intentionallinkUrlfallback selection). Codegen is deterministic (re-running produces no diff) and the regenerated files are committed.yarn test— 37 suites / 161 tests pass.Not in this PR / needs device testing
AppDelegateredirect handler, Android intent-filter, plus a redirect URI registered in the Plaid dashboard. Non-OAuth Link works without it; wiring this blind (untestable here) would be guesswork, so it's a tracked follow-up.pod install(autolinked; the repo'spostinstallruns it onyarn install) and Android autolink/build were not exercised in the authoring environment.⚠ Sequencing — do not merge yet
bridgeExchangePlaidPublicTokendoes not exist server-side until flash#446 is merged and deployed. Kept as a draft until then. Once #446 is live: verify on device, then un-draft.🤖 Generated with Claude Code