Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/controllers/concerns/idv/step_utilities_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ module Idv
module StepUtilitiesConcern
extend ActiveSupport::Concern

def flow_session
user_session['idv/doc_auth']
end

# copied from doc_auth_controller
def flow_path
flow_session[:flow_path]
end

# Copied from capture_doc_flow.rb
# and from doc_auth_flow.rb
def acuant_sdk_ab_test_analytics_args
Expand Down
16 changes: 14 additions & 2 deletions app/controllers/concerns/idv_step_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@ module IdvStepConcern
before_action :confirm_idv_needed
end

def flow_session
user_session['idv/doc_auth']
end

def pii_from_doc
flow_session&.[]('pii_from_doc')
end

# copied from doc_auth_controller
def flow_path
flow_session[:flow_path]
end

def confirm_document_capture_complete
@pii = flow_session&.[]('pii_from_doc') # hash with indifferent access
return if @pii.present?
return if pii_from_doc.present?

flow_path = flow_session&.[](:flow_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we remove this line if it's now a method above?

Also, do we need the nil-safe access in the method above? I notice we have it here and in pii_from_doc.

Suggested change
flow_path = flow_session&.[](:flow_path)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks. We do need the nil protection in case someone jumps to the /verify/ssn step without a flow_session - we were seeing 500s in prod, so we added that. I took this line out and added nil protection in #flow_path.

Expand Down
20 changes: 3 additions & 17 deletions app/controllers/idv/address_controller.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Idv
class AddressController < ApplicationController
include IdvSession
include IdvStepConcern

before_action :confirm_two_factor_authenticated
before_action :confirm_document_capture_complete

def new
analytics.idv_address_visit

@presenter = AddressPresenter.new(pii: @pii)
@presenter = AddressPresenter.new(pii: pii_from_doc)
end

def update
Expand All @@ -24,22 +24,8 @@ def update

private

def confirm_document_capture_complete
@pii = user_session.dig('idv/doc_auth', 'pii_from_doc')
return if @pii.present?

flow_path = user_session.dig('idv/doc_auth', :flow_path)

if IdentityConfig.store.doc_auth_document_capture_controller_enabled &&
flow_path == 'standard'
redirect_to idv_document_capture_url
else
redirect_to idv_doc_auth_url
end
end

def idv_form
Idv::AddressForm.new(@pii)
Idv::AddressForm.new(pii_from_doc)
end

def success
Expand Down
1 change: 1 addition & 0 deletions app/controllers/idv/document_capture_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Idv
class DocumentCaptureController < ApplicationController
include IdvSession
include IdvStepConcern
include StepIndicatorConcern
include StepUtilitiesConcern
include DocumentCaptureConcern
Expand Down
1 change: 1 addition & 0 deletions app/controllers/idv/in_person/verify_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Idv
module InPerson
class VerifyInfoController < ApplicationController
include IdvSession
include IdvStepConcern
include StepIndicatorConcern
include StepUtilitiesConcern
include VerifyInfoConcern
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/ssn_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def extra_view_variables
private

def next_url
if @pii[:state] == 'PR'
if pii_from_doc[:state] == 'PR'
idv_address_url
else
idv_verify_info_url
Expand Down