diff --git a/app/services/idv/proofing_components.rb b/app/services/idv/proofing_components.rb index c549046c6e1..4045fa72dff 100644 --- a/app/services/idv/proofing_components.rb +++ b/app/services/idv/proofing_components.rb @@ -11,7 +11,7 @@ def document_check end def document_type - return 'state_id' if idv_session.remote_document_capture_complete? + idv_session.pii_from_doc&.id_doc_type end def source_check diff --git a/lib/idp/constants.rb b/lib/idp/constants.rb index 09a3b09870c..b4471b792be 100644 --- a/lib/idp/constants.rb +++ b/lib/idp/constants.rb @@ -123,6 +123,29 @@ module Vendors zipcode: '59010-1234', }.freeze + MOCK_IDV_APPLICANT_STATE_ID = { + address1: '1 FAKE RD', + address2: '', + city: 'GREAT FALLS', + dob: '1938-10-06', + eye_color: nil, + first_name: 'FAKEY', + height: 72, + issuing_country_code: 'US', + last_name: 'MCFAKERSON', + middle_name: nil, + name_suffix: 'JR', + state: MOCK_IDV_APPLICANT_STATE, + state_id_expiration: '2099-12-31', + state_id_issued: '2019-12-31', + state_id_jurisdiction: MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, + state_id_number: '1111111111111', + id_doc_type: 'state_id', + sex: 'male', + weight: nil, + zipcode: '59010-1234', + }.freeze + MOCK_IPP_APPLICANT = { first_name: 'FAKEY', last_name: 'MCFAKERSON', diff --git a/spec/controllers/idv/link_sent_controller_spec.rb b/spec/controllers/idv/link_sent_controller_spec.rb index f5e047c99d6..3d0a388ac18 100644 --- a/spec/controllers/idv/link_sent_controller_spec.rb +++ b/spec/controllers/idv/link_sent_controller_spec.rb @@ -180,7 +180,7 @@ idv_session: subject.idv_session, ) expect(proofing_components.document_check).to eq('mock') - expect(proofing_components.document_type).to eq('state_id') + expect(proofing_components.document_type).to eq('drivers_license') end context 'redo document capture' do diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 4df76ffd99b..541ba235873 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -43,7 +43,7 @@ let(:base_proofing_components) do { document_check: 'mock', - document_type: 'state_id', + document_type: 'drivers_license', source_check: 'StateIdMock', resolution_check: 'ResolutionMock', residential_resolution_check: 'ResidentialAddressNotRequired', @@ -243,22 +243,22 @@ 'IdV: doc auth image upload vendor pii validation' => { success: true, user_id: user.uuid, submit_attempts: 1, remaining_submit_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String), liveness_checking_required: boolean, classification_info: {}, id_issued_status: 'present', id_expiration_status: 'present', passport_issued_status: 'missing', passport_expiration_status: 'missing', document_type: an_instance_of(String), id_doc_type: an_instance_of(String) }, - 'IdV: doc auth document_capture submitted' => hash_including(success: true, flow_path: 'standard', step: 'document_capture', analytics_id: 'Doc Auth', selfie_check_required: boolean, liveness_checking_required: boolean, proofing_components: { document_check: 'mock', document_type: 'state_id' }), + 'IdV: doc auth document_capture submitted' => hash_including(success: true, flow_path: 'standard', step: 'document_capture', analytics_id: 'Doc Auth', selfie_check_required: boolean, liveness_checking_required: boolean, proofing_components: { document_check: 'mock', document_type: 'drivers_license' }), 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth ssn submitted' => { success: true, flow_path: 'standard', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, idv_threatmetrix_response_body: ( if threatmetrix_response_body.present? @@ -371,19 +371,19 @@ }, 'IdV: doc auth ssn visited' => { flow_path: 'hybrid', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth ssn submitted' => { success: true, flow_path: 'hybrid', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify visited' => { flow_path: 'hybrid', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify submitted' => { flow_path: 'hybrid', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, idv_threatmetrix_response_body: ( if threatmetrix_response_body.present? @@ -490,23 +490,23 @@ }, 'IdV: doc auth document_capture submitted' => { success: true, flow_path: 'standard', step: 'document_capture', analytics_id: 'Doc Auth', selfie_check_required: boolean, liveness_checking_required: boolean, - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth ssn submitted' => { success: true, flow_path: 'standard', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, idv_threatmetrix_response_body: ( if threatmetrix_response_body.present? @@ -734,26 +734,26 @@ }, 'IdV: doc auth document_capture submitted' => { success: true, flow_path: 'standard', step: 'document_capture', analytics_id: 'Doc Auth', selfie_check_required: boolean, liveness_checking_required: true, - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, :idv_selfie_image_added => { acuant_version: kind_of(String), captureAttempts: 1, fingerprint: 'aIzxkX_iMtoxFOURZr55qkshs53emQKUOr7VfTf6G1Q', flow_path: 'standard', height: 38, mimeType: 'image/png', size: 3694, source: 'upload', width: 284, liveness_checking_required: boolean, selfie_attempts: 0 }, 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth ssn submitted' => { success: true, flow_path: 'standard', step: 'ssn', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', analytics_id: 'Doc Auth', - proofing_components: { document_check: 'mock', document_type: 'state_id' } + proofing_components: { document_check: 'mock', document_type: 'drivers_license' } }, idv_threatmetrix_response_body: ( if threatmetrix_response_body.present? diff --git a/spec/features/idv/cancel_spec.rb b/spec/features/idv/cancel_spec.rb index 6eb3a6ea745..b954e52ec49 100644 --- a/spec/features/idv/cancel_spec.rb +++ b/spec/features/idv/cancel_spec.rb @@ -121,7 +121,7 @@ expect(page).to have_content(t('idv.cancel.headings.prompt.standard')) expect(fake_analytics).to have_logged_event( 'IdV: cancellation visited', - proofing_components: { document_check: 'mock', document_type: 'state_id' }, + proofing_components: { document_check: 'mock', document_type: 'drivers_license' }, request_came_from: 'idv/ssn#show', step: 'ssn', ) @@ -137,7 +137,7 @@ expect(fake_analytics).to have_logged_event( 'IdV: cancellation go back', - proofing_components: { document_check: 'mock', document_type: 'state_id' }, + proofing_components: { document_check: 'mock', document_type: 'drivers_license' }, step: 'ssn', ) @@ -147,7 +147,7 @@ expect(fake_analytics).to have_logged_event( 'IdV: start over', - proofing_components: { document_check: 'mock', document_type: 'state_id' }, + proofing_components: { document_check: 'mock', document_type: 'drivers_license' }, step: 'ssn', ) @@ -159,7 +159,7 @@ expect(fake_analytics).to have_logged_event( 'IdV: cancellation confirmed', step: 'ssn', - proofing_components: { document_check: 'mock', document_type: 'state_id' }, + proofing_components: { document_check: 'mock', document_type: 'drivers_license' }, ) end end diff --git a/spec/features/idv/end_to_end_idv_spec.rb b/spec/features/idv/end_to_end_idv_spec.rb index 8014a0618e4..43f91f61c9f 100644 --- a/spec/features/idv/end_to_end_idv_spec.rb +++ b/spec/features/idv/end_to_end_idv_spec.rb @@ -342,7 +342,7 @@ def validate_enter_password_submit(user) 'source_check' => 'StateIdMock', 'threatmetrix' => true, 'address_check' => 'lexis_nexis_address', - 'document_type' => 'state_id', + 'document_type' => 'drivers_license', 'document_check' => 'mock', 'residential_resolution_check' => 'ResidentialAddressNotRequired', 'resolution_check' => 'ResolutionMock', diff --git a/spec/features/idv/proofing_components_spec.rb b/spec/features/idv/proofing_components_spec.rb index 63d4f16c426..4d1f266dd1b 100644 --- a/spec/features/idv/proofing_components_spec.rb +++ b/spec/features/idv/proofing_components_spec.rb @@ -30,7 +30,7 @@ it 'records proofing components' do proofing_components = user.active_profile.proofing_components expect(proofing_components['document_check']).to eq('mock') - expect(proofing_components['document_type']).to eq('state_id') + expect(proofing_components['document_type']).to eq('drivers_license') expect(proofing_components['source_check']).to eq('StateIdMock') end end diff --git a/spec/services/idv/agent_spec.rb b/spec/services/idv/agent_spec.rb index 8cb0cc2847b..b64af08c570 100644 --- a/spec/services/idv/agent_spec.rb +++ b/spec/services/idv/agent_spec.rb @@ -147,7 +147,7 @@ expect(ResolutionProofingJob).to receive(:perform_later).with( hash_including( proofing_components: { - document_type: 'state_id', + document_type: 'drivers_license', }, ), ) diff --git a/spec/services/idv/analytics_events_enhancer_spec.rb b/spec/services/idv/analytics_events_enhancer_spec.rb index 1cf65613a41..225769c75d5 100644 --- a/spec/services/idv/analytics_events_enhancer_spec.rb +++ b/spec/services/idv/analytics_events_enhancer_spec.rb @@ -100,7 +100,7 @@ def track_event(_event, **kwargs) expect(analytics.called_kwargs).to eql( extra: true, proofing_components: { - document_type: 'state_id', + document_type: 'drivers_license', }, ) end diff --git a/spec/services/idv/proofing_components_spec.rb b/spec/services/idv/proofing_components_spec.rb index 97645db4bae..251fbb50da5 100644 --- a/spec/services/idv/proofing_components_spec.rb +++ b/spec/services/idv/proofing_components_spec.rb @@ -26,8 +26,6 @@ end describe '#to_h' do - let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT } - before do allow(IdentityConfig.store).to receive(:doc_auth_vendor_default).and_return('test_vendor') idv_session.mark_verify_info_step_complete! @@ -40,18 +38,58 @@ idv_session.doc_auth_vendor = 'feedabee' end - it 'returns expected result' do - expect(subject.to_h).to eql( - { - document_check: 'feedabee', - document_type: 'state_id', - source_check: 'aamva', - resolution_check: 'lexis_nexis', - address_check: 'gpo_letter', - threatmetrix: true, - threatmetrix_review_status: 'pass', - }, - ) + context 'with drivers_license' do + let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT } + + it 'returns expected result' do + expect(subject.to_h).to eql( + { + document_check: 'feedabee', + document_type: 'drivers_license', + source_check: 'aamva', + resolution_check: 'lexis_nexis', + address_check: 'gpo_letter', + threatmetrix: true, + threatmetrix_review_status: 'pass', + }, + ) + end + end + + context 'with state_id' do + let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID } + + it 'returns expected result' do + expect(subject.to_h).to eql( + { + document_check: 'feedabee', + document_type: 'state_id', + source_check: 'aamva', + resolution_check: 'lexis_nexis', + address_check: 'gpo_letter', + threatmetrix: true, + threatmetrix_review_status: 'pass', + }, + ) + end + end + + context 'with passport' do + let(:pii_from_doc) { Idp::Constants::MOCK_IDV_PROOFING_PASSPORT_APPLICANT } + + it 'returns expected result' do + expect(subject.to_h).to eql( + { + document_check: 'feedabee', + document_type: 'passport', + source_check: 'aamva', + resolution_check: 'lexis_nexis', + address_check: 'gpo_letter', + threatmetrix: true, + threatmetrix_review_status: 'pass', + }, + ) + end end end @@ -93,7 +131,15 @@ let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT } it 'returns doc auth vendor' do - expect(subject.document_type).to eql('state_id') + expect(subject.document_type).to eql('drivers_license') + end + end + + context 'after doc auth completed successfully with passport' do + let(:pii_from_doc) { Idp::Constants::MOCK_IDV_PROOFING_PASSPORT_APPLICANT } + + it 'returns doc auth vendor' do + expect(subject.document_type).to eql('passport') end end end