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
1 change: 1 addition & 0 deletions app/controllers/concerns/idv/document_capture_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def extract_pii_from_doc(user, response, store_in_session: false)
if store_in_session
idv_session.pii_from_doc ||= {}
idv_session.pii_from_doc.merge!(pii_from_doc)
idv_session.selfie_check_performed = response.selfie_check_performed
end
end

Expand Down
20 changes: 15 additions & 5 deletions app/services/idv/profile_maker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def save_profile(
fraud_pending_reason:,
gpo_verification_needed:,
in_person_verification_needed:,
selfie_check_performed:,
deactivation_reason: nil
)
profile = Profile.new(user: user, active: false, deactivation_reason: deactivation_reason)
Expand All @@ -27,11 +28,10 @@ def save_profile(
profile.proofing_components = current_proofing_components
profile.fraud_pending_reason = fraud_pending_reason

profile.idv_level = if in_person_verification_needed
:legacy_in_person
else
:legacy_unsupervised
end
profile.idv_level = set_idv_level(
in_person_verification_needed: in_person_verification_needed,
selfie_check_performed: selfie_check_performed,
)

profile.save!
profile.deactivate_for_gpo_verification if gpo_verification_needed
Expand All @@ -43,6 +43,16 @@ def save_profile(

private

def set_idv_level(in_person_verification_needed:, selfie_check_performed:)
if in_person_verification_needed
:legacy_in_person
elsif !FeatureManagement.idv_block_biometrics_requests? && selfie_check_performed
:unsupervised_with_selfie
else
:legacy_unsupervised
end
end

def current_proofing_components
user.proofing_component&.as_json || {}
end
Expand Down
2 changes: 2 additions & 0 deletions app/services/idv/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Session
profile_id
redo_document_capture
resolution_successful
selfie_check_performed
skip_doc_auth
skip_hybrid_handoff
ssn
Expand Down Expand Up @@ -63,6 +64,7 @@ def create_profile_from_applicant_with_password(user_password)
fraud_pending_reason: threatmetrix_fraud_pending_reason,
gpo_verification_needed: !phone_confirmed? || verify_by_mail?,
in_person_verification_needed: current_user.has_in_person_enrollment?,
selfie_check_performed: session[:selfie_check_performed],
)

profile.activate unless profile.reason_not_to_activate
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/idv/link_sent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
allow(load_result).to receive(:attention_with_barcode?).and_return(false)

allow(load_result).to receive(:success?).and_return(load_result_success)
allow(load_result).to receive(:selfie_check_performed).and_return(false)

document_capture_session = DocumentCaptureSession.create!(
user: user,
Expand Down
56 changes: 45 additions & 11 deletions spec/services/idv/profile_maker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
fraud_pending_reason: nil,
gpo_verification_needed: false,
in_person_verification_needed: false,
selfie_check_performed: false,
)
pii = subject.pii_attributes

Expand All @@ -45,6 +46,7 @@
gpo_verification_needed: false,
deactivation_reason: :encryption_error,
in_person_verification_needed: false,
selfie_check_performed: false,
)
end
it 'creates an inactive profile with deactivation reason' do
Expand All @@ -69,6 +71,7 @@
gpo_verification_needed: false,
deactivation_reason: nil,
in_person_verification_needed: false,
selfie_check_performed: false,
)
end
it 'creates a pending profile for fraud review' do
Expand All @@ -93,6 +96,7 @@
gpo_verification_needed: true,
deactivation_reason: nil,
in_person_verification_needed: false,
selfie_check_performed: false,
)
end
it 'creates a pending profile for gpo verification' do
Expand All @@ -117,6 +121,7 @@
gpo_verification_needed: false,
deactivation_reason: nil,
in_person_verification_needed: true,
selfie_check_performed: false,
)
end
it 'creates a pending profile for in person verification' do
Expand All @@ -136,26 +141,54 @@
end

context 'as active' do
let(:selfie_check_performed) { false }
let(:profile) do
subject.save_profile(
fraud_pending_reason: nil,
gpo_verification_needed: false,
deactivation_reason: nil,
in_person_verification_needed: false,
selfie_check_performed: selfie_check_performed,
)
end
it 'creates an active profile' do
expect(profile.activated_at).to be_nil
expect(profile.active).to eq(false)
expect(profile.deactivation_reason).to be_nil
expect(profile.fraud_pending_reason).to be_nil
expect(profile.fraud_review_pending?).to eq(false)
expect(profile.gpo_verification_pending_at.present?).to eq(false)
expect(profile.initiating_service_provider).to eq(nil)
expect(profile.verified_at).to be_nil

context 'legacy unsupervised' do
it 'creates an active profile' do
expect(profile.activated_at).to be_nil
expect(profile.active).to eq(false)
expect(profile.deactivation_reason).to be_nil
expect(profile.fraud_pending_reason).to be_nil
expect(profile.fraud_review_pending?).to eq(false)
expect(profile.gpo_verification_pending_at.present?).to eq(false)
expect(profile.initiating_service_provider).to eq(nil)
expect(profile.verified_at).to be_nil
end
it 'marks the profile as legacy_unsupervised' do
expect(profile.idv_level).to eql('legacy_unsupervised')
end
end
it 'marks the profile as legacy_unsupervised' do
expect(profile.idv_level).to eql('legacy_unsupervised')

context 'unsupervised with selfie' do
let(:selfie_check_performed) { true }

before do
allow(FeatureManagement).to receive(:idv_block_biometrics_requests?).
and_return(false)
end

it 'creates an active profile' do
expect(profile.activated_at).to be_nil
expect(profile.active).to eq(false)
expect(profile.deactivation_reason).to be_nil
expect(profile.fraud_pending_reason).to be_nil
expect(profile.fraud_review_pending?).to eq(false)
expect(profile.gpo_verification_pending_at.present?).to eq(false)
expect(profile.initiating_service_provider).to eq(nil)
expect(profile.verified_at).to be_nil
end
it 'marks the profile as unsupervised_with_selfie' do
expect(profile.idv_level).to eql('unsupervised_with_selfie')
end
end
end

Expand All @@ -167,6 +200,7 @@
gpo_verification_needed: false,
deactivation_reason: nil,
in_person_verification_needed: false,
selfie_check_performed: false,
)
end
it 'creates a profile with the initiating sp recorded' do
Expand Down