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
2 changes: 1 addition & 1 deletion app/controllers/concerns/idv_step_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def redirect_for_mail_only
end

def pii_from_doc
flow_session['pii_from_doc']
flow_session[:pii_from_doc]
end

def pii_from_user
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/address_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def idv_form

def success
profile_params.each do |key, value|
flow_session['pii_from_doc'][key] = value
flow_session[:pii_from_doc][key] = value
end
redirect_to idv_verify_info_url
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/idv/document_capture_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def confirm_hybrid_handoff_complete
def confirm_document_capture_needed
return if idv_session.redo_document_capture

pii = flow_session['pii_from_doc'] # hash with indifferent access
return if pii.blank? && !idv_session.verify_info_step_complete?
return if pii_from_doc.blank? && !idv_session.verify_info_step_complete?

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

pii = flow_session['pii_from_doc'] # hash with indifferent access
return if pii.blank? && !idv_session.verify_info_step_complete?
return if 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/session_errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def rate_limited
private

def ssn_from_doc
user_session&.dig('idv/doc_auth', 'pii_from_doc', 'ssn')
user_session&.dig('idv/doc_auth', :pii_from_doc, 'ssn')
end

def confirm_two_factor_authenticated_or_user_id_in_session
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 @@ -38,7 +38,7 @@ def update
)

if form_response.success?
flow_session['pii_from_doc'][:ssn] = params[:doc_auth][:ssn]
flow_session[:pii_from_doc][:ssn] = params[:doc_auth][:ssn]
idv_session.invalidate_steps_after_ssn!
redirect_to next_url
else
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

# copied from verify_step
def pii
@pii = flow_session[:pii_from_doc]
@pii = pii_from_doc
end
end
end
2 changes: 1 addition & 1 deletion app/forms/idv/ssn_format_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.model_name

def initialize(user, flow_session = {})
@user = user
@ssn = flow_session.dig('pii_from_doc', :ssn)
@ssn = flow_session.dig(:pii_from_doc, :ssn)
@updating_ssn = ssn.present?
end

Expand Down
6 changes: 2 additions & 4 deletions spec/controllers/idv/address_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN.stringify_keys }

let(:flow_session) do
{
'pii_from_doc' => pii_from_doc,
}
{ pii_from_doc: pii_from_doc }
end

before do
Expand Down Expand Up @@ -60,7 +58,7 @@
it 'updates pii_from_doc' do
expect do
put :update, params: params
end.to change { flow_session['pii_from_doc'] }.to eql(
end.to change { flow_session[:pii_from_doc] }.to eql(
pii_from_doc.merge(
{
'address1' => '1234 Main St',
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv/document_capture_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

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

expect(response).to redirect_to(idv_ssn_url)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv/link_sent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

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

expect(response).to redirect_to(idv_ssn_url)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv/session_errors_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
rate_limit_type: :proof_ssn,
target: Pii::Fingerprinter.fingerprint(ssn),
).increment_to_limited!
controller.user_session['idv/doc_auth'] = { 'pii_from_doc' => { 'ssn' => ssn } }
controller.user_session['idv/doc_auth'] = { pii_from_doc: { 'ssn' => ssn } }
end

it 'assigns expiration time' do
Expand Down
18 changes: 8 additions & 10 deletions spec/controllers/idv/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
include IdvHelper

let(:flow_session) do
{ 'document_capture_session_uuid' => 'fd14e181-6fb1-4cdc-92e0-ef66dad0df4e',
'pii_from_doc' => Idp::Constants::MOCK_IDV_APPLICANT.dup,
:threatmetrix_session_id => 'c90ae7a5-6629-4e77-b97c-f1987c2df7d0' }
{ pii_from_doc: Idp::Constants::MOCK_IDV_APPLICANT.dup }
end

let(:ssn) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN[:ssn] }
Expand Down Expand Up @@ -95,7 +93,7 @@
context 'with an ssn in session' do
let(:referer) { idv_document_capture_url }
before do
flow_session['pii_from_doc'][:ssn] = ssn
flow_session[:pii_from_doc][:ssn] = ssn
request.env['HTTP_REFERER'] = referer
end

Expand Down Expand Up @@ -158,21 +156,21 @@
it 'merges ssn into pii session value' do
put :update, params: params

expect(flow_session['pii_from_doc'][:ssn]).to eq(ssn)
expect(flow_session[:pii_from_doc][:ssn]).to eq(ssn)
end

context 'with a Puerto Rico address' do
it 'redirects to address controller after user enters their SSN' do
flow_session['pii_from_doc'][:state] = 'PR'
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
flow_session['pii_from_doc'][:ssn] = ssn
flow_session['pii_from_doc'][:state] = 'PR'
flow_session[:pii_from_doc][:ssn] = ssn
flow_session[:pii_from_doc][:state] = 'PR'

put :update, params: params

Expand All @@ -198,7 +196,7 @@
end

it 'does not change threatmetrix_session_id when updating ssn' do
flow_session['pii_from_doc'][:ssn] = ssn
flow_session[:pii_from_doc][:ssn] = ssn
put :update, params: params
session_id = subject.idv_session.threatmetrix_session_id
subject.threatmetrix_view_variables
Expand Down Expand Up @@ -239,7 +237,7 @@
context 'when pii_from_doc is not present' do
before do
subject.idv_session.flow_path = 'standard'
flow_session.delete('pii_from_doc')
flow_session.delete(:pii_from_doc)
end

it 'redirects to DocumentCaptureController on standard flow' do
Expand Down
5 changes: 1 addition & 4 deletions spec/controllers/idv/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
include IdvHelper

let(:flow_session) do
{ 'error_message' => nil,
'document_capture_session_uuid' => 'fd14e181-6fb1-4cdc-92e0-ef66dad0df4e',
:pii_from_doc => Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN.dup,
'threatmetrix_session_id' => 'c90ae7a5-6629-4e77-b97c-f1987c2df7d0' }
{ pii_from_doc: Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN.dup }
end

let(:user) { create(:user) }
Expand Down
2 changes: 1 addition & 1 deletion spec/forms/idv/ssn_format_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
end

context 'when there is an SSN in the pii_from_doc hash' do
let(:flow_session) { { 'pii_from_doc' => { ssn: '900-12-3456' } } }
let(:flow_session) { { pii_from_doc: { ssn: '900-12-3456' } } }

it { expect(subject.updating_ssn?).to eq(true) }
end
Expand Down