Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions app/controllers/concerns/idv/document_capture_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ def extract_pii_from_doc(user, response, store_in_session: false)
uuid_prefix: ServiceProvider.find_by(issuer: sp_session[:issuer])&.app_id,
)

if defined?(flow_session) && defined?(idv_session) # hybrid mobile does not have idv_session
if defined?(idv_session) # hybrid mobile does not have idv_session
idv_session.had_barcode_read_failure = response.attention_with_barcode?
if store_in_session
flow_session[:pii_from_doc] ||= {}
flow_session[:pii_from_doc].merge!(pii_from_doc)
idv_session.pii_from_doc ||= {}
idv_session.pii_from_doc.merge!(pii_from_doc)
idv_session.clear_applicant!
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,10 @@ def move_applicant_to_idv_session
end

def delete_pii
flow_session.delete(:pii_from_doc)
idv_session.pii_from_doc = nil
flow_session.delete(:pii_from_user)
if defined?(flow_session) # no longer defined for remote flow
flow_session.delete(:pii_from_user)
end
end

def add_proofing_costs(results)
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/concerns/idv_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ def idv_session
)
end

def flow_session
user_session['idv/doc_auth'] ||= {}
end

def irs_reproofing?
current_user&.reproof_for_irs?(
service_provider: current_sp,
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/concerns/idv_step_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ def redirect_for_mail_only
redirect_to idv_mail_only_warning_url
end

def pii_from_doc
idv_session.pii_from_doc || flow_session[:pii_from_doc]
end

def pii_from_user
flow_session['pii_from_user']
end
Expand All @@ -57,7 +53,7 @@ def confirm_ssn_step_complete
end

def confirm_document_capture_complete
return if pii_from_doc.present?
return if idv_session.pii_from_doc.present?

if flow_path == 'standard'
redirect_to idv_document_capture_url
Expand Down
8 changes: 2 additions & 6 deletions app/controllers/idv/address_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AddressController < ApplicationController
def new
analytics.idv_address_visit

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

def update
Expand All @@ -24,17 +24,13 @@ def update
private

def idv_form
Idv::AddressForm.new(pii_from_doc)
Idv::AddressForm.new(idv_session.pii_from_doc)
end

def success
# Make sure pii_from_doc is available in both places so we can
# update the address for both and keep them in sync
idv_session.pii_from_doc = pii_from_doc
profile_params.each do |key, value|
idv_session.pii_from_doc[key] = value
end
flow_session[:pii_from_doc] = idv_session.pii_from_doc
redirect_to idv_verify_info_url
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/document_capture_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def confirm_hybrid_handoff_complete
def confirm_document_capture_needed
return if idv_session.redo_document_capture

return if pii_from_doc.blank? && !idv_session.verify_info_step_complete?
return if idv_session.pii_from_doc.blank? && !idv_session.verify_info_step_complete?

redirect_to idv_ssn_url
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/link_sent_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def confirm_hybrid_handoff_complete
def confirm_document_capture_needed
return if idv_session.redo_document_capture

return if pii_from_doc.blank? && !idv_session.verify_info_step_complete?
return if idv_session.pii_from_doc.blank? && !idv_session.verify_info_step_complete?

redirect_to idv_ssn_url
end
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 @@ -57,7 +57,7 @@ def confirm_repeat_ssn
end

def next_url
if pii_from_doc[:state] == 'PR' && !updating_ssn?
if idv_session.pii_from_doc[:state] == 'PR' && !updating_ssn?
idv_address_url
else
idv_verify_info_url
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/verify_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def analytics_arguments
end

def pii
@pii = pii_from_doc
@pii = idv_session.pii_from_doc
end
end
end
1 change: 0 additions & 1 deletion spec/controllers/concerns/rate_limit_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def update
before(:each) do
sign_in(user)
allow(subject).to receive(:current_user).and_return(user)
allow(subject).to receive(:flow_session).and_return({})
routes.draw do
get 'show' => 'idv/step#show'
put 'update' => 'idv/step#update'
Expand Down
31 changes: 3 additions & 28 deletions spec/controllers/idv/address_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@

let(:user) { create(:user) }

let(:idv_session) { subject.idv_session }

let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN.stringify_keys }

let(:flow_session) do
{ pii_from_doc: pii_from_doc }
end

before do
stub_sign_in(user)
stub_analytics
stub_idv_steps_before_verify_step(user)
subject.idv_session.flow_path = 'standard'
subject.idv_session.pii_from_doc = pii_from_doc
subject.user_session['idv/doc_auth'] = flow_session
end

describe '#new' do
Expand Down Expand Up @@ -53,31 +46,13 @@
it 'sets address_edited in idv_session' do
expect do
put :update, params: params
end.to change { idv_session.address_edited }.from(nil).to eql(true)
end

it 'updates pii_from_doc in flow_session (even if nil)' do
flow_session[:pii_from_doc] = nil
expect do
put :update, params: params
end.to change { flow_session[:pii_from_doc] }.to eql(
pii_from_doc.merge(
{
'address1' => '1234 Main St',
'address2' => 'Apt B',
'city' => 'Beverly Hills',
'state' => 'CA',
'zipcode' => '90210',
},
),
)
end.to change { subject.idv_session.address_edited }.from(nil).to eql(true)
end

it 'updates pii_from_doc in idv_session (even if nil)' do
subject.idv_session.pii_from_doc = nil
it 'updates pii_from_doc in idv_session' do
expect do
put :update, params: params
end.to change { idv_session.pii_from_doc }.to eql(
end.to change { subject.idv_session.pii_from_doc }.to eql(
pii_from_doc.merge(
{
'address1' => '1234 Main St',
Expand Down
12 changes: 0 additions & 12 deletions spec/controllers/idv/document_capture_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

let(:document_capture_session_uuid) { 'fd14e181-6fb1-4cdc-92e0-ef66dad0df4e' }

let(:flow_session) { {} }

let(:user) { create(:user) }

let(:ab_test_args) do
Expand All @@ -18,7 +16,6 @@
stub_analytics
subject.idv_session.flow_path = 'standard'
subject.idv_session.document_capture_session_uuid = document_capture_session_uuid
subject.user_session['idv/doc_auth'] = flow_session

allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args)
end
Expand Down Expand Up @@ -107,15 +104,6 @@
end
end

context 'with pii in flow session' do
it 'redirects to ssn step' do
flow_session[:pii_from_doc] = Idp::Constants::MOCK_IDV_APPLICANT
get :show

expect(response).to redirect_to(idv_ssn_url)
end
end

context 'with pii in idv_session' do
it 'redirects to ssn step' do
subject.idv_session.pii_from_doc = Idp::Constants::MOCK_IDV_APPLICANT
Expand Down
5 changes: 2 additions & 3 deletions spec/controllers/idv/in_person/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

let(:pii_from_user) { Idp::Constants::MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID.dup }
let(:flow_session) do
{ 'document_capture_session_uuid' => 'fd14e181-6fb1-4cdc-92e0-ef66dad0df4e',
:pii_from_user => pii_from_user,
:flow_path => 'standard' }
{ pii_from_user: pii_from_user,
flow_path: 'standard' }
end

let(:user) { build(:user, :with_phone, with: { phone: '+1 (415) 555-0130' }) }
Expand Down
12 changes: 0 additions & 12 deletions spec/controllers/idv/link_sent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
RSpec.describe Idv::LinkSentController do
include IdvHelper

let(:flow_session) { {} }

let(:user) { create(:user) }

let(:ab_test_args) do
{ sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 }
end

before do
allow(subject).to receive(:flow_session).and_return(flow_session)
stub_sign_in(user)
subject.idv_session.flow_path = 'hybrid'
stub_analytics
Expand Down Expand Up @@ -97,15 +94,6 @@
end
end

context 'with pii in flow_session' do
it 'redirects to ssn step' do
flow_session[:pii_from_doc] = Idp::Constants::MOCK_IDV_APPLICANT
get :show

expect(response).to redirect_to(idv_ssn_url)
end
end

context 'with pii in idv_session' do
it 'redirects to ssn step' do
subject.idv_session.pii_from_doc = Idp::Constants::MOCK_IDV_APPLICANT
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/idv/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

let(:idv_session) { double }
let(:flow_session) { { x: {} } }

let(:pii) { { first_name: 'Jane' } }

context 'when destroying the session' do
Expand Down
28 changes: 0 additions & 28 deletions spec/controllers/idv/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
RSpec.describe Idv::SsnController do
include IdvHelper

let(:flow_session) do
{ pii_from_doc: Idp::Constants::MOCK_IDV_APPLICANT.dup }
end

let(:ssn) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN[:ssn] }

let(:user) { create(:user) }
Expand All @@ -17,7 +13,6 @@

before do
stub_sign_in(user)
subject.user_session['idv/doc_auth'] = flow_session
subject.idv_session.flow_path = 'standard'
subject.idv_session.pii_from_doc = Idp::Constants::MOCK_IDV_APPLICANT.dup
stub_analytics
Expand Down Expand Up @@ -159,28 +154,6 @@
from(nil).to(ssn)
end

context 'with a Puerto Rico address and pii_from_doc in flow_session' do
before do
subject.idv_session.pii_from_doc = nil
end
it 'redirects to address controller after user enters their SSN' do
flow_session[:pii_from_doc][:state] = 'PR'

put :update, params: params

expect(response).to redirect_to(idv_address_url)
end

it 'redirects to the verify info controller if a user is updating their SSN' do
subject.idv_session.ssn = ssn
flow_session[:pii_from_doc][:state] = 'PR'

put :update, params: params

expect(response).to redirect_to(idv_verify_info_url)
end
end

context 'with a Puerto Rico address and pii_from_doc in idv_session' do
it 'redirects to address controller after user enters their SSN' do
subject.idv_session.pii_from_doc[:state] = 'PR'
Expand Down Expand Up @@ -259,7 +232,6 @@
context 'when pii_from_doc is not present' do
before do
subject.idv_session.flow_path = 'standard'
flow_session.delete(:pii_from_doc)
subject.idv_session.pii_from_doc = nil
end

Expand Down
Loading