Skip to content

LG-9489 Hybrid mobile document capture controller#8243

Merged
matthinz merged 34 commits intomainfrom
matthinz/9489-doc-capture
Apr 25, 2023
Merged

LG-9489 Hybrid mobile document capture controller#8243
matthinz merged 34 commits intomainfrom
matthinz/9489-doc-capture

Conversation

@matthinz
Copy link
Contributor

@matthinz matthinz commented Apr 18, 2023

🎫 Ticket

LG-9489

🛠 Summary of changes

The current "hybrid" document capture flow (the thing where you text yourself a special link you can use to take pictures of your ID with your phone) relies on the flow state machine.

This PR adds the third of three new controllers to replace the flow state machine version of this codepath.

The hybrid flow was always a strange beast, since the user is not technically "logged in" while they are uploading their documents--they have the ability to upload documents related to a specific DocumentCaptureSession.

Most of this PR is copy/pasting document-capture related code and specs, and adapting it slightly to work in a hybrid flow context where none of the following are available:

  • user_session
  • flow_session
  • idv_session

Where code can be shared between the hybrid flow and other idv controllers, this sharing is done with concerns that depend on controllers implementing a document_capture_session_uuid method. In the hybrid flow, that uuid is read from session, whereas in IdV, it comes out of flow_session. There will be more cleanup / refactoring work to do after this lands and we migrate production traffic to this route.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Enable the doc_auth_hybrid_mobile_controllers_enabled feature flag in your application.yml
  • Sign up and enter the identity verification flow
  • Enter a phone number to send yourself a link to upload your photos
  • Verify that the link refers to the path /verify/documents--that is the path for this new set of controllers
  • Open the link in a new browser and upload your images
  • When told to return to your computer, close the browser and verify you can proceed through the flow.

@matthinz matthinz force-pushed the matthinz/9489-doc-capture branch 3 times, most recently from a27f9aa to db6d479 Compare April 19, 2023 23:09
@matthinz matthinz force-pushed the matthinz/9489-doc-capture branch from 8139750 to 6a51160 Compare April 20, 2023 17:12
Rather than a separate feature test for the capture complete step, incorporate its checks into the feature test for the full hybrid flow.
We don't have a flow_session to work with

def page_with_trust?
return false if current_page?(controller: 'users/sessions', action: 'new')
return false if current_page?(controller: '/users/sessions', action: 'new')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When rendering layouts/base from idv/hybrid_mobile/document_capture_controller, rails would attempt to resolve users/session here as idv/users/sessions, which would error out. Prefixing this with a / fixed it (which, I did not realize directory-style controller references could do that), but there may be some tweaks to routing or something that could obviate the need for this.

Add a spec for the AcuantConcern
@@ -0,0 +1,39 @@
module Idv
module AcuantConcern
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This concern shows how I'm thinking code sharing can work between hybrid and non-hybrid flows--it depends on the controller itself to implement document_capture_session_uuid, and does not contain references to e.g. flow_session

@matthinz matthinz marked this pull request as ready for review April 20, 2023 23:01
@matthinz matthinz requested a review from a team April 20, 2023 23:01
Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall! Let me know if you want to sync up on the changes I made to desktop DocumentCaptureController while deleting the feature flag.

document_capture_session_uuid: document_capture_session_uuid,
flow_path: 'hybrid',
sp_name: decorated_session.sp_name,
failure_to_proof_url: idv_doc_auth_return_to_sp_url,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another recent change in the desktop DocumentCapture code, make this take a failure_to_proof_url variable that gets set directly rather than taking a detour through a route to DocAuthController#return_to_sp.

Copy link
Contributor Author

@matthinz matthinz Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 9624023 This was actually addressed in 243e65c, but I'm not 100% on if failure_to_proof_url is actually used in the hybrid flow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in the shared template. It's reachable when there's a barcode error or something like that, which I think could happen on mobile too.

@soniaconnolly
Copy link
Contributor

At some point we'll need to move the STEP_INDICATOR_STEPS out of CaptureDocFlow. Maybe when we delete the feature flag and delete that whole flow.

@soniaconnolly soniaconnolly requested a review from jmhooper April 21, 2023 23:19
Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and it worked! LGTM.

@matthinz
Copy link
Contributor Author

Okey doke, I'm going to land in the interest of moving this forward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants