Skip to content

Fix Async Hybrid Flow (LG-4172)#4665

Merged
zachmargolis merged 6 commits intomasterfrom
margolis-async-hybrid-flow
Feb 11, 2021
Merged

Fix Async Hybrid Flow (LG-4172)#4665
zachmargolis merged 6 commits intomasterfrom
margolis-async-hybrid-flow

Conversation

@zachmargolis
Copy link
Contributor

@zachmargolis zachmargolis commented Feb 11, 2021

Opening this as a draft so I can collect some ideas/feedback

This is good to go now, I'm going to chase down the various specs that are failing

status == DocumentCaptureSessionAsyncResult::DONE
end

alias_method :success?, :done?
Copy link
Contributor Author

@zachmargolis zachmargolis Feb 11, 2021

Choose a reason for hiding this comment

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

reason this is needed: the capture doc flow expects to load a DocumentCaptureSessionResult which is basically the same as this one, except that it responds to success?

Comment on lines +19 to +20
result = document_capture_session.load_result ||
document_capture_session.load_doc_auth_async_result
Copy link
Contributor Author

@zachmargolis zachmargolis Feb 11, 2021

Choose a reason for hiding this comment

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

reason this is needed: the VerifyDocumentAction stores data via store_doc_auth_result which still contains PII but has slightly different redis keys than the store_result_from_response that the old flow uses

Comment on lines +33 to +39
verify_document_capture_session = if hybrid_flow_mobile?
document_capture_session
else
create_document_capture_session(
verify_document_capture_session_uuid_key,
)
end
Copy link
Contributor Author

@zachmargolis zachmargolis Feb 11, 2021

Choose a reason for hiding this comment

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

reason this is needed: in the hybrid mobile flow, the document_capture_session is the UUID that the desktop sent over, so that's where the desktop is polling for results. In the non-hybrid flow, we can generate a new key like this does

Copy link
Contributor

Choose a reason for hiding this comment

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

the key is only used once either way, so we don't need to worry about overwriting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe, yes

Comment on lines +11 to +12
verify_document: Idv::Actions::VerifyDocumentAction,
verify_document_status: Idv::Actions::VerifyDocumentStatusAction,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reason this is needed: these polling actions for async work were missing from the hybrid flow

Comment on lines +34 to +37
@document_capture_session_result ||= (
document_capture_session&.load_result ||
document_capture_session&.load_doc_auth_async_result
)
Copy link
Contributor Author

@zachmargolis zachmargolis Feb 11, 2021

Choose a reason for hiding this comment

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

allow loading data from the async flow

document_capture_session_uuid: flow_session[:document_capture_session_uuid],
endpoint: FeatureManagement.document_capture_async_uploads_enabled? ?
idv_doc_auth_step_path(step: :verify_document) :
send(@step_url, step: :verify_document) :
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reason this is needed:

In the non-hybrid flow, we link to /idv/doc_auth etc endpoints. However, in the hybrid flow, the mobile path hits /idv/capture_doc/ versions of the corresponding endpoints, so this needed to be updated to be dynamic based on the flow

@zachmargolis zachmargolis marked this pull request as ready for review February 11, 2021 18:10
allow(FeatureManagement).to receive(:document_capture_async_uploads_enabled?).
and_return(async_uploads_enabled)

assign(:step_url, :idv_doc_auth_step_url)
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 is the key change in this file, now that the partial uses @step_url. The rest of the changes in the file were to simplify and minimize stubbing

@zachmargolis zachmargolis merged commit aa47f1d into master Feb 11, 2021
@zachmargolis zachmargolis deleted the margolis-async-hybrid-flow branch February 11, 2021 23:46
@stevegsa
Copy link
Contributor

Great work @zachmargolis !!!

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.

4 participants