Repository navigation
feat(idv): ID capture, evidence upload and verification status (ENG-608 Phase 1) - #736
Conversation
…resubmit Review fixes for #736. - Logout: `cleanUp` reset the accountUpgrade slice but left the captures under <documents>/idv/ with nothing referencing them, so photos of a government ID survived the account that took them. Add `removeIdentityDir` and call it before `resetAccountUpgrade`. - Resubmit: `submitAccountUpgrade` flattened the upload failure to `errors`, dropping `failedSide`/`reason`, so a file-reason failure on the resubmit path kept the side in the slice with confirm enabled and Try again failed identically. `UpgradeResult` now carries both and IdentityReview clears the side on `reason === "file"` exactly as the first-submission branch does. Tests: removeIdentityDir cases, a use-logout spec pinning the wipe before the slice reset, resubmit file/network failure cases on IdentityReview, and the hook spec now asserts the propagated side/reason. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Adds the three-screen ID capture step to the L2/L3 upgrade flow, between phone validation and business information: - IdentityDocumentType: passport / national ID / driver's licence. A passport skips the back side. - IdentityCapture (side = front | back | selfie): vision-camera still with an SVG scrim overlay (card window or selfie oval), a resolution/aspect gate on the captured still, preview with Retake / Use photo, and a permission-denied state that links to Settings. Nothing uploads here. - IdentityReview: thumbnails with per-side retake; confirm is disabled until every required side is present. The accountUpgrade slice replaces bankInfo.idDocument with an identity block (document type, issuing country, per-side captures, and per-side upload bookkeeping so a retry reuses keys already in storage). The slice is persisted, so a redux-persist v1 migration drops the old shape and maps the legacy status strings. PhotoUploadField is removed from BankInformation and deleted; nothing else used it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…G-608) useAccountUpgrade gains uploadEvidence(): each required side goes through the existing idDocumentUploadUrlGenerate + presigned PUT, with a hex SHA-256 of the file (js-sha256 over a react-native-fs base64 read; no new native dependency). Keys are recorded per side as they land, so a failure mid-set leaves nothing to re-send but what is missing. submitAccountUpgrade builds evidence[] (ID_FRONT, ID_BACK, SELFIE) and keeps the legacy idDocument = front key for older backends. The address is now collected for real: BusinessInformation shows editable line1 / line2 / city / parish / postal code / country fields (prefilled by the Places search), required for every level. The "1 Grenada Way" / "Kingston 5" / "000000" fallback and the PII console.log of the request input are gone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
LatestAccountUpgradeRequest now reads verification { status reasonCode
reasonMessage reviewedAt } and the slice stores the enum instead of the raw
ERPNext string.
- AccountType shows a status card: Submitted / Under review / More
information needed (reviewer's message + Resubmit into the identity
flow) / Approved / Not approved (reviewer's message).
- QuickStart and the upgrade button treat SUBMITTED and UNDER_REVIEW as
pending and surface the resubmit prompt on MORE_INFO_NEEDED.
- The bank cash-out / business setups gain a step for identity.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
New AccountUpgrade strings for the capture flow, address fields and status card; typesafe-i18n regenerated and the 23 locale files backfilled with the English source so check:translation-drift passes. public-schema.graphql refreshed from lnflash/flash feat/eng-608-idv-status (PR #515) for AccountUpgradeRequest.verification; generated.ts/.gql regenerated. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ew (ENG-608) - evidence builder: order, legacy key, passport has no back, metadata on ID sides only; upload planning reuses unchanged keys - capture dimension gate; address validation with no fallback - status enum to label / tone / CTA mapping - slice: retake drops the stale key; persist v1 migration - IdentityReview renders three thumbnails, disables confirm until all present, uploads before moving on, keeps a retry on partial failure - AccountType status card + Resubmit CTA; QuickStart and upgrade button on the new enum Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ENG-608) Captures no longer live in the OS temp directory. On accept the still is moved into <documents>/idv/<side>-<ts>.jpg and the slice persists only the document-relative path; the absolute path is rebuilt at read time (iOS changes the container path on every update). IdentityReview checks each side's file on mount and clears any that is gone so the card reads "Not taken yet" and confirm disables. - upload failures carry a reason (file | network); IdentityReview surfaces the hook's message for file problems and clears that side instead of a generic retry that fails forever; network failures keep the capture - uploadOne checks the file exists before requesting a presigned URL - fileSha256Hex uses native RNFS.hash instead of a base64 read + pure-JS SHA-256 on the JS thread - issuingCountry dropped: the schema field is optional and there is no picker, so nothing is sent rather than "JM" on every document - aspect gate removed (takePhoto returns the full sensor frame, so it could never fire); captureBadShape key removed from all 24 locales - resetIdentity is dispatched and the stills unlinked once the upgrade request is on file; switching document type also unlinks old captures - IdentityCapture has a close control (headerShown is false, and the permission-denied / no-camera branches had no way out) - tests: use-account-upgrade.spec (upload loop, key reuse, stop on first failure, no submit on partial failure, evidence + legacy idDocument), identity-capture.spec (permission, gate, accept/persist/next side, close), identity-files.spec, plus review/slice/utils spec updates Co-Authored-By: Claude Fable 5.1 <[email protected]>
…resubmit Review fixes for #736. - Logout: `cleanUp` reset the accountUpgrade slice but left the captures under <documents>/idv/ with nothing referencing them, so photos of a government ID survived the account that took them. Add `removeIdentityDir` and call it before `resetAccountUpgrade`. - Resubmit: `submitAccountUpgrade` flattened the upload failure to `errors`, dropping `failedSide`/`reason`, so a file-reason failure on the resubmit path kept the side in the slice with confirm enabled and Try again failed identically. `UpgradeResult` now carries both and IdentityReview clears the side on `reason === "file"` exactly as the first-submission branch does. Tests: removeIdentityDir cases, a use-logout spec pinning the wipe before the slice reset, resubmit file/network failure cases on IdentityReview, and the hook spec now asserts the propagated side/reason. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Both were pre-existing patterns my diff touched, so the gate flagged them:
- upgrade-trial-account: the #FF7e1c literal duplicated the palette's
_orange token; moved into useStyles as awaitingReview.
- BankInformation: the global alert() is banned by no-alert; use
Alert.alert("", msg), matching the rest of the flow.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
4f56042 to
6c7f0dc
Compare
Device test — Pixel 8 Pro (Android 17 / API 37), targetSdk 36, TEST backendDrove the whole flow on hardware against TEST with flash#515 live on the cluster. Passes: document-type screen; front capture with the card overlay, close control and shutter; passport correctly skips the back side straight to the selfie; selfie uses the oval overlay and the front camera; preview Retake / Use photo; review screen shows exactly two rows with per-side retake; Backend round trip: AUR One gap, not a blocker: Worth knowing for anyone else testing this: at level Zero, |
Mobile half of ENG-608 (ID verification, Phase 1). Adds structured ID capture to the bank cash-out (L2) and business (L3) upgrade flows, sends
evidence[]to the backend, and surfaces the reviewer's verification status in the app.Flow
AccountType → PersonalInformation → [Validation] → IdentityDocumentType → IdentityCapture(front) → [IdentityCapture(back)] → IdentityCapture(selfie) → IdentityReview → BusinessInformation → BankInformation → SuccessThree new screens in
app/screens/account-upgrade-flow/:side: front | back | selfie) —useCameraDevice(side === "selfie" ? "front" : "back"),photoQualityBalance="quality"on theCamera,takePhoto({ enableShutterSound: false }). SVG scrim overlay with a rounded ID-card window (front/back) or an oval (selfie), drawn withreact-native-svg(already a dependency). The still is gated client-side: long edge < 1200 px or aspect outside 1.15–2.4 is rejected with a plain message and a retake. Then a full-screen preview with Retake / Use photo. Permission denied shows a message and an Open Settings button. Nothing leaves the phone on this screen.New components:
CaptureOverlay,CapturePreviewinapp/components/account-upgrade-flow/.PhotoUploadFieldis removed fromBankInformationand deleted (nothing else used it).What uploads, when
useAccountUpgrade().uploadEvidence()loops front → back → selfie through the existingidDocumentUploadUrlGeneratemutation + presigned PUT. Each file's hex SHA-256 is computed client-side withjs-sha256over areact-native-fsbase64 read (both already inpackage.json; no new native dependency). Per-side keys are recorded in the slice as each PUT completes, so a failure mid-set shows a retry that only re-sends what is missing; a retake invalidates that side's key.submitAccountUpgrade()buildsevidence: [{ type: ID_FRONT, fileKey, sha256, documentType, issuingCountry }, { type: ID_BACK, … }, { type: SELFIE, fileKey, sha256 }]and keeps the legacyidDocument= front key so older backends keep working. Partial upload failure → no submit.Status UI
LatestAccountUpgradeRequestaddsverification { status reasonCode reasonMessage reviewedAt }. TheaccountUpgradeslice stores the enum (SUBMITTED | UNDER_REVIEW | MORE_INFO_NEEDED | APPROVED | REJECTED) plusreasonCode/reasonMessage.AccountTypeshows a status card: Submitted / Under review / More information needed (reviewer'sreasonMessage+ Resubmit →IdentityDocumentTypewithresubmit: true) / Approved / Not approved (reasonMessage).QuickStartand the account-settings upgrade button treatSUBMITTEDandUNDER_REVIEWas pending;MORE_INFO_NEEDEDshows the resubmit prompt with the reviewer's message.Address
L2 now collects a real address.
BusinessInformationshows editable street / line 2 (optional) / city / parish / postal code (optional) / country (default Jamaica) fields, prefilled by the existing Places search, required and validated for every level. The"1 Grenada Way" / "Kingston 5" / "000000"fallback and theconsole.logof the request input (PII) inuseAccountUpgradeare gone, as is the"000000"postal-code fallback in the Places handler.Decisions (already made, not re-opened here)
idDocument(front key) is sent alongsideevidence[].qualityPrioritizationis not atakePhotooption in vision-camera 4.7.3; the equivalent is thephotoQualityBalance="quality"camera prop, which is what is used.Persisted state
accountUpgradeis whitelisted in redux-persist. This PR bumps the persist version to 1 with a migration that dropsbankInfo.idDocument, maps the oldPending / Approved / Rejectedstrings to the enum, adds theidentityblock and defaults the country. Killing the app mid-flow keeps the captures (file URIs) and any keys already uploaded.Backend dependency
Requires lnflash/flash#515 (
feat/eng-608-idv-status) forAccountUpgradeRequest.verification.app/graphql/public-schema.graphqlwas refreshed from that branch (git show origin/feat/eng-608-idv-status:src/graphql/public/schema.graphql), so theschema-driftCI check will fail on this PR until #515 is on flashmain. Against a backend without #515 theLatestAccountUpgradeRequestquery itself errors (unknown field), so this should ship after or with the backend.Tests
yarn testgreen (see check results in the PR conversation). New specs:__tests__/utils/identity-verification.spec.ts— evidence builder (order, legacy key, passport has no back, metadata only on ID sides), upload planning / key reuse, capture dimension gate, address validation with no fallback, status → label/tone/CTA mapping.__tests__/store/account-upgrade-slice.spec.ts— retake drops the stale key; persist v1 migration.__tests__/screens/identity-review.spec.tsx— renders three thumbnails (two for passport), confirm disabled until all present, uploads before navigating, partial failure keeps a retry, resubmit path submits.__tests__/screens/account-type-status.spec.tsx— status card for each status, reviewer reason, Resubmit CTA intoIdentityDocumentType, step count.quick-start.spec.tsx/upgrade-trial-account.spec.tsxupdated to the new enum, withMORE_INFO_NEEDEDcases.yarn check-codegreen (tsc, translations, codegen, graphql-check);check:translation-driftgreen (23 locales backfilled with English, same as #729).Device checklist (not run here; nothing ran on a device)
idDocumentUploadUrlGenerateper side)image/jpgnormalisation still applies (ENG-291)🤖 Generated with Claude Code