diff --git a/app/controllers/concerns/idv/step_utilities_concern.rb b/app/controllers/concerns/idv/step_utilities_concern.rb index 31c4a4f8924..227d3e697a3 100644 --- a/app/controllers/concerns/idv/step_utilities_concern.rb +++ b/app/controllers/concerns/idv/step_utilities_concern.rb @@ -14,10 +14,16 @@ def flow_path def confirm_pii_from_doc @pii = flow_session&.[]('pii_from_doc') # hash with indifferent access return if @pii.present? + flow_session&.delete('Idv::Steps::DocumentCaptureStep') redirect_to idv_doc_auth_url end + def confirm_profile_not_already_confirmed + return unless idv_session.profile_confirmation == true + redirect_to idv_review_url + end + # Copied from capture_doc_flow.rb # and from doc_auth_flow.rb def acuant_sdk_ab_test_analytics_args diff --git a/app/controllers/idv/doc_auth_controller.rb b/app/controllers/idv/doc_auth_controller.rb index 99ead51788d..2861a53eb7f 100644 --- a/app/controllers/idv/doc_auth_controller.rb +++ b/app/controllers/idv/doc_auth_controller.rb @@ -23,7 +23,7 @@ class DocAuthController < ApplicationController FLOW_STATE_MACHINE_SETTINGS = { step_url: :idv_doc_auth_step_url, - final_url: :idv_review_url, + final_url: :idv_ssn_url, flow: Idv::Flows::DocAuthFlow, analytics_id: 'Doc Auth', }.freeze diff --git a/app/controllers/idv/ssn_controller.rb b/app/controllers/idv/ssn_controller.rb index 6e8eaf16c3a..a1c85b156ab 100644 --- a/app/controllers/idv/ssn_controller.rb +++ b/app/controllers/idv/ssn_controller.rb @@ -6,6 +6,7 @@ class SsnController < ApplicationController include Steps::ThreatMetrixStepHelper before_action :confirm_two_factor_authenticated + before_action :confirm_profile_not_already_confirmed before_action :confirm_pii_from_doc attr_accessor :error_message diff --git a/app/controllers/idv/verify_info_controller.rb b/app/controllers/idv/verify_info_controller.rb index 05818921dec..c7943036c50 100644 --- a/app/controllers/idv/verify_info_controller.rb +++ b/app/controllers/idv/verify_info_controller.rb @@ -85,11 +85,7 @@ def update private def prev_url - if IdentityConfig.store.doc_auth_ssn_controller_enabled - idv_ssn_url - else - idv_doc_auth_url - end + idv_ssn_url end def analytics_arguments @@ -118,11 +114,6 @@ def confirm_ssn_step_complete redirect_to prev_url end - def confirm_profile_not_already_confirmed - return unless idv_session.profile_confirmation == true - redirect_to idv_review_url - end - def current_flow_step_counts user_session['idv/doc_auth_flow_step_counts'] ||= {} user_session['idv/doc_auth_flow_step_counts'].default = 0 diff --git a/app/services/idv/actions/cancel_update_ssn_action.rb b/app/services/idv/actions/cancel_update_ssn_action.rb deleted file mode 100644 index d8b7b52b82d..00000000000 --- a/app/services/idv/actions/cancel_update_ssn_action.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Idv - module Actions - class CancelUpdateSsnAction < Idv::Steps::DocAuthBaseStep - def self.analytics_submitted_event - :idv_doc_auth_cancel_update_ssn_submitted - end - - def call - mark_step_complete(:ssn) if flow_session.dig(:pii_from_doc, :ssn) - end - end - end -end diff --git a/app/services/idv/flows/doc_auth_flow.rb b/app/services/idv/flows/doc_auth_flow.rb index da38c8bfb53..539a1b707d6 100644 --- a/app/services/idv/flows/doc_auth_flow.rb +++ b/app/services/idv/flows/doc_auth_flow.rb @@ -9,7 +9,6 @@ class DocAuthFlow < Flow::BaseFlow link_sent: Idv::Steps::LinkSentStep, email_sent: Idv::Steps::EmailSentStep, document_capture: Idv::Steps::DocumentCaptureStep, - ssn: Idv::Steps::SsnStep, }.freeze STEP_INDICATOR_STEPS = [ @@ -34,9 +33,7 @@ class DocAuthFlow < Flow::BaseFlow ACTIONS = { cancel_send_link: Idv::Actions::CancelSendLinkAction, cancel_link_sent: Idv::Actions::CancelLinkSentAction, - cancel_update_ssn: Idv::Actions::CancelUpdateSsnAction, redo_address: Idv::Actions::RedoAddressAction, - redo_ssn: Idv::Actions::RedoSsnAction, redo_document_capture: Idv::Actions::RedoDocumentCaptureAction, verify_document_status: Idv::Actions::VerifyDocumentStatusAction, }.freeze diff --git a/app/services/idv/steps/doc_auth_base_step.rb b/app/services/idv/steps/doc_auth_base_step.rb index bbc63bf9e7d..965e1518fd3 100644 --- a/app/services/idv/steps/doc_auth_base_step.rb +++ b/app/services/idv/steps/doc_auth_base_step.rb @@ -34,7 +34,8 @@ def extract_pii_from_doc(response, store_in_session: false) flow_session[:had_barcode_read_failure] = response.attention_with_barcode? if store_in_session - flow_session[:pii_from_doc] = flow_session[:pii_from_doc].to_h.merge(pii_from_doc) + flow_session[:pii_from_doc] ||= {} + flow_session[:pii_from_doc].merge!(pii_from_doc) idv_session.delete('applicant') end track_document_state(pii_from_doc[:state]) diff --git a/app/services/idv/steps/document_capture_step.rb b/app/services/idv/steps/document_capture_step.rb index ffbf18d9bc3..fde17c9985d 100644 --- a/app/services/idv/steps/document_capture_step.rb +++ b/app/services/idv/steps/document_capture_step.rb @@ -16,7 +16,7 @@ def self.analytics_submitted_event def call handle_stored_result if !FeatureManagement.document_capture_async_uploads_enabled? - exit_flow_state_machine if IdentityConfig.store.doc_auth_ssn_controller_enabled + exit_flow_state_machine end def extra_view_variables @@ -42,7 +42,6 @@ def extra_view_variables def exit_flow_state_machine flow_session[:flow_path] = @flow.flow_path - redirect_to idv_ssn_url if @flow.instance_of?(Idv::Flows::DocAuthFlow) end def native_camera_ab_testing_variables diff --git a/app/services/idv/steps/link_sent_step.rb b/app/services/idv/steps/link_sent_step.rb index 6a70a8815a5..d4bd0e779e7 100644 --- a/app/services/idv/steps/link_sent_step.rb +++ b/app/services/idv/steps/link_sent_step.rb @@ -28,16 +28,11 @@ def extra_view_variables private - def exit_flow_state_machine - flow_session[:flow_path] = @flow.flow_path - redirect_to idv_ssn_url - end - def handle_document_verification_success(get_results_response) save_proofing_components extract_pii_from_doc(get_results_response, store_in_session: true) mark_steps_complete - exit_flow_state_machine if IdentityConfig.store.doc_auth_ssn_controller_enabled + flow_session[:flow_path] = @flow.flow_path end def render_document_capture_cancelled diff --git a/app/services/idv/steps/ssn_step.rb b/app/services/idv/steps/ssn_step.rb deleted file mode 100644 index 97239d09048..00000000000 --- a/app/services/idv/steps/ssn_step.rb +++ /dev/null @@ -1,61 +0,0 @@ -module Idv - module Steps - class SsnStep < DocAuthBaseStep - STEP_INDICATOR_STEP = :verify_info - - include ThreatMetrixStepHelper - - def self.analytics_visited_event - :idv_doc_auth_ssn_visited - end - - def self.analytics_submitted_event - :idv_doc_auth_ssn_submitted - end - - def call - return invalid_state_response if invalid_state? - - flow_session[:pii_from_doc][:ssn] = ssn - - @flow.irs_attempts_api_tracker.idv_ssn_submitted( - ssn: ssn, - ) - - idv_session.delete('applicant') - - flow_session[:flow_path] = @flow.flow_path - end - - def extra_view_variables - { - updating_ssn: updating_ssn, - **threatmetrix_view_variables, - } - end - - private - - def form_submit - Idv::SsnFormatForm.new(current_user).submit(permit(:ssn)) - end - - def invalid_state_response - mark_step_incomplete(:document_capture) - FormResponse.new(success: false) - end - - def ssn - flow_params[:ssn] - end - - def invalid_state? - flow_session[:pii_from_doc].nil? - end - - def updating_ssn - flow_session.dig(:pii_from_doc, :ssn).present? - end - end - end -end diff --git a/app/views/idv/ssn/show.html.erb b/app/views/idv/ssn/show.html.erb index f744c8ccedb..3d15e363595 100644 --- a/app/views/idv/ssn/show.html.erb +++ b/app/views/idv/ssn/show.html.erb @@ -85,7 +85,7 @@ locals: <% end %> <% if updating_ssn %> - <%= render 'idv/shared/back', action: 'cancel_update_ssn' %> + <%= render 'idv/shared/back', fallback_path: idv_verify_info_path %> <% else %> <%= render 'idv/doc_auth/cancel', step: 'ssn' %> <% end %> diff --git a/app/views/idv/verify_info/show.html.erb b/app/views/idv/verify_info/show.html.erb index c69ec8c4530..e1ef651e17a 100644 --- a/app/views/idv/verify_info/show.html.erb +++ b/app/views/idv/verify_info/show.html.erb @@ -123,24 +123,13 @@ locals: toggle_label: t('forms.ssn.show'), ) %> - <% if IdentityConfig.store.doc_auth_ssn_controller_enabled %> -
- <%= link_to( - t('idv.buttons.change_label'), - idv_ssn_url, - 'aria-label': t('idv.buttons.change_ssn_label'), - ) %> -
- <% else %> -
- <%= button_to( - idv_doc_auth_step_url(step: :redo_ssn), - method: :put, - class: 'usa-button usa-button--unstyled', - 'aria-label': t('idv.buttons.change_ssn_label'), - ) { t('idv.buttons.change_label') } %> -
- <% end %> +
+ <%= link_to( + t('idv.buttons.change_label'), + idv_ssn_url, + 'aria-label': t('idv.buttons.change_ssn_label'), + ) %> +
<%= render SpinnerButtonComponent.new( diff --git a/config/application.yml.default b/config/application.yml.default index 478b8e5fff2..d520e7e3844 100644 --- a/config/application.yml.default +++ b/config/application.yml.default @@ -71,7 +71,6 @@ doc_auth_combined_hybrid_handoff_enabled: false doc_auth_error_dpi_threshold: 290 doc_auth_error_sharpness_threshold: 40 doc_auth_error_glare_threshold: 40 -doc_auth_ssn_controller_enabled: false database_pool_extra_connections_for_worker: 4 database_pool_idp: 5 database_statement_timeout: 2_500 diff --git a/lib/identity_config.rb b/lib/identity_config.rb index e5982dfcfc6..b8bea22e84a 100644 --- a/lib/identity_config.rb +++ b/lib/identity_config.rb @@ -167,7 +167,6 @@ def self.build_store(config_map) config.add(:doc_auth_max_submission_attempts_before_native_camera, type: :integer) config.add(:doc_auth_max_capture_attempts_before_tips, type: :integer) config.add(:doc_auth_s3_request_timeout, type: :integer) - config.add(:doc_auth_ssn_controller_enabled, type: :boolean) config.add(:doc_auth_vendor, type: :string) config.add(:doc_auth_vendor_randomize, type: :boolean) config.add(:doc_auth_vendor_randomize_percent, type: :integer) diff --git a/spec/controllers/idv/doc_auth_controller_spec.rb b/spec/controllers/idv/doc_auth_controller_spec.rb index 3aadf2c879a..7170c1abfd5 100644 --- a/spec/controllers/idv/doc_auth_controller_spec.rb +++ b/spec/controllers/idv/doc_auth_controller_spec.rb @@ -142,7 +142,7 @@ it 'finishes the flow' do get :show, params: { step: 'welcome' } - expect(response).to redirect_to idv_review_url + expect(response).to redirect_to idv_ssn_url end end end @@ -155,19 +155,18 @@ result = { success: true, errors: {}, - step: 'ssn', + step: 'agreement', flow_path: 'standard', step_count: 1, - pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]], irs_reproofing: false, analytics_id: 'Doc Auth', acuant_sdk_upgrade_ab_test_bucket: :default, } - put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '111-11-1111' } } + put :update, params: { step: 'agreement', doc_auth: { ial2_consent_given: '1' } } expect(@analytics).to have_received(:track_event).with( - 'IdV: doc auth ssn submitted', result + 'IdV: doc auth agreement submitted', result ) end @@ -176,20 +175,20 @@ allow_any_instance_of(Flow::BaseFlow).to \ receive(:flow_session).and_return(pii_from_doc: {}) - put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '666-66-6666' } } - put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '111-11-1111' } } + put :update, params: { step: 'agreement', doc_auth: { ial2_consent_given: '1' } } + put :update, params: { step: 'agreement', doc_auth: { ial2_consent_given: '1' } } expect(@analytics).to have_received(:track_event).with( - 'IdV: doc auth ssn submitted', + 'IdV: doc auth agreement submitted', hash_including( - step: 'ssn', + step: 'agreement', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, ), ) expect(@analytics).to have_received(:track_event).with( - 'IdV: doc auth ssn submitted', - hash_including(step: 'ssn', step_count: 2), + 'IdV: doc auth agreement submitted', + hash_including(step: 'agreement', step_count: 2), ) end @@ -233,7 +232,7 @@ it 'finishes the flow' do put :update, params: { step: 'ssn' } - expect(response).to redirect_to idv_review_url + expect(response).to redirect_to idv_ssn_url end end end diff --git a/spec/controllers/idv/verify_info_controller_spec.rb b/spec/controllers/idv/verify_info_controller_spec.rb index 1209c2cc509..9d48f410ac7 100644 --- a/spec/controllers/idv/verify_info_controller_spec.rb +++ b/spec/controllers/idv/verify_info_controller_spec.rb @@ -100,6 +100,14 @@ end end + it 'redirects to ssn controller when ssn info is missing' do + flow_session[:pii_from_doc][:ssn] = nil + + get :show + + expect(response).to redirect_to(idv_ssn_url) + end + context 'when the user is ssn throttled' do before do Throttle.new( @@ -110,21 +118,6 @@ ).increment_to_throttled! end - context 'when using new ssn controller' do - before do - allow(IdentityConfig.store).to receive(:doc_auth_ssn_controller_enabled). - and_return(true) - end - - it 'redirects to ssn controller when ssn info is missing' do - flow_session[:pii_from_doc][:ssn] = nil - - get :show - - expect(response).to redirect_to(idv_ssn_url) - end - end - it 'redirects to ssn failure url' do get :show diff --git a/spec/features/idv/actions/redo_document_capture_action_spec.rb b/spec/features/idv/actions/redo_document_capture_action_spec.rb index 19dd5d685cd..55dde9e3f43 100644 --- a/spec/features/idv/actions/redo_document_capture_action_spec.rb +++ b/spec/features/idv/actions/redo_document_capture_action_spec.rb @@ -29,6 +29,9 @@ DocAuth::Mock::DocAuthMockClient.reset! attach_and_submit_images + expect(current_path).to eq(idv_ssn_path) + fill_out_ssn_form_with_ssn_that_fails_resolution + click_on t('forms.buttons.submit.update') expect(current_path).to eq(idv_verify_info_path) check t('forms.ssn.show') expect(page).to have_content(DocAuthHelper::SSN_THAT_FAILS_RESOLUTION) @@ -62,6 +65,9 @@ DocAuth::Mock::DocAuthMockClient.reset! attach_and_submit_images + expect(current_path).to eq(idv_ssn_path) + fill_out_ssn_form_with_ssn_that_fails_resolution + click_on t('forms.buttons.submit.update') expect(current_path).to eq(idv_verify_info_path) check t('forms.ssn.show') expect(page).to have_content(DocAuthHelper::SSN_THAT_FAILS_RESOLUTION) diff --git a/spec/features/idv/cancel_spec.rb b/spec/features/idv/cancel_spec.rb index 793b2e734c2..25695e60558 100644 --- a/spec/features/idv/cancel_spec.rb +++ b/spec/features/idv/cancel_spec.rb @@ -92,7 +92,7 @@ expect(fake_analytics).to have_logged_event( 'IdV: cancellation visited', proofing_components: { document_check: 'mock', document_type: 'state_id' }, - request_came_from: 'idv/doc_auth#show', + request_came_from: 'idv/ssn#show', step: 'ssn', ) diff --git a/spec/features/idv/doc_auth/document_capture_step_spec.rb b/spec/features/idv/doc_auth/document_capture_step_spec.rb index a630d6094c0..a59ea8dece3 100644 --- a/spec/features/idv/doc_auth/document_capture_step_spec.rb +++ b/spec/features/idv/doc_auth/document_capture_step_spec.rb @@ -207,22 +207,8 @@ end end - context 'when new ssn controller is enabled' do - before do - allow(IdentityConfig.store).to receive(:doc_auth_ssn_controller_enabled). - and_return(true) - end - it 'redirects to ssn controller' do - expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_id')) - - attach_and_submit_images - - expect(page).to have_current_path(idv_ssn_url) - end - end - def next_step - idv_doc_auth_ssn_step + idv_ssn_url end def expect_costing_for_document diff --git a/spec/features/idv/doc_auth/link_sent_step_spec.rb b/spec/features/idv/doc_auth/link_sent_step_spec.rb index e3d5281e940..157a3ef8fe1 100644 --- a/spec/features/idv/doc_auth/link_sent_step_spec.rb +++ b/spec/features/idv/doc_auth/link_sent_step_spec.rb @@ -22,7 +22,7 @@ mock_doc_captured(user.id) click_idv_continue - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_path) end it 'proceeds to the next page if the user does not have a phone' do @@ -32,7 +32,7 @@ mock_doc_captured(user.id) click_idv_continue - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_path) end it 'does not proceed to the next page if the capture flow is incomplete' do @@ -80,7 +80,7 @@ mock_doc_captured(user.id) expect(page).to have_content(t('doc_auth.headings.ssn'), wait: 6) - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_path) end end diff --git a/spec/features/idv/doc_auth/ssn_spec.rb b/spec/features/idv/doc_auth/ssn_spec.rb deleted file mode 100644 index d1d7c6b373d..00000000000 --- a/spec/features/idv/doc_auth/ssn_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'rails_helper' - -feature 'doc auth ssn step', :js do - include IdvStepHelper - include DocAuthHelper - include DocCaptureHelper - - before do - allow(IdentityConfig.store).to receive(:proofing_device_profiling).and_return(:enabled) - allow(IdentityConfig.store).to receive(:lexisnexis_threatmetrix_org_id).and_return('test_org') - allow(IdentityConfig.store).to receive(:doc_auth_ssn_controller_enabled).and_return(true) - - sign_in_and_2fa_user - complete_doc_auth_steps_before_ssn_step - end - - it 'proceeds to the next page with valid info' do - expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_info')) - - fill_out_ssn_form_ok - - match = page.body.match(/session_id=(?[^"&]+)/) - session_id = match && match[:session_id] - expect(session_id).to be_present - - select 'Review', from: 'mock_profiling_result' - - expect(page.find_field(t('idv.form.ssn_label_html'))['aria-invalid']).to eq('false') - click_idv_continue - - expect(page).to have_current_path(idv_verify_info_url) - - profiling_result = Proofing::Mock::DeviceProfilingBackend.new.profiling_result(session_id) - expect(profiling_result).to eq('review') - end - - it 'does not proceed to the next page with invalid info' do - fill_out_ssn_form_fail - click_idv_continue - - expect(page.find_field(t('idv.form.ssn_label_html'))['aria-invalid']).to eq('true') - - expect(page).to have_current_path(idv_ssn_url) - end -end diff --git a/spec/features/idv/doc_auth/ssn_step_spec.rb b/spec/features/idv/doc_auth/ssn_step_spec.rb index b7c1269bf56..6bb05ad4506 100644 --- a/spec/features/idv/doc_auth/ssn_step_spec.rb +++ b/spec/features/idv/doc_auth/ssn_step_spec.rb @@ -27,7 +27,7 @@ expect(page.find_field(t('idv.form.ssn_label_html'))['aria-invalid']).to eq('false') click_idv_continue - expect(page).to have_current_path(idv_verify_info_path) + expect(page).to have_current_path(idv_verify_info_url) profiling_result = Proofing::Mock::DeviceProfilingBackend.new.profiling_result(session_id) expect(profiling_result).to eq('review') @@ -39,6 +39,6 @@ expect(page.find_field(t('idv.form.ssn_label_html'))['aria-invalid']).to eq('true') - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_url) end end diff --git a/spec/features/idv/doc_auth/test_credentials_spec.rb b/spec/features/idv/doc_auth/test_credentials_spec.rb index a7c57d8818b..2117b529bdf 100644 --- a/spec/features/idv/doc_auth/test_credentials_spec.rb +++ b/spec/features/idv/doc_auth/test_credentials_spec.rb @@ -23,7 +23,7 @@ attach_file 'Back of your ID', File.expand_path('spec/fixtures/ial2_test_credential.yml') click_on 'Submit' - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_path) fill_out_ssn_form_ok click_idv_continue diff --git a/spec/features/idv/doc_auth/verify_info_step_spec.rb b/spec/features/idv/doc_auth/verify_info_step_spec.rb index d4df7d5ca15..ffdb0b95940 100644 --- a/spec/features/idv/doc_auth/verify_info_step_spec.rb +++ b/spec/features/idv/doc_auth/verify_info_step_spec.rb @@ -61,10 +61,15 @@ end it 'allows the user to enter in a new ssn and displays updated info' do - click_button t('idv.buttons.change_ssn_label') + click_link t('idv.buttons.change_ssn_label') + expect(page).to have_current_path(idv_ssn_path) fill_in t('idv.form.ssn_label_html'), with: '900456789' click_button t('forms.buttons.submit.update') + expect(fake_analytics).to have_logged_event( + 'IdV: doc auth redo_ssn submitted', + ) + expect(page).to have_current_path(idv_verify_info_path) expect(page).to have_text('9**-**-***9') @@ -372,31 +377,4 @@ expect(page).to have_current_path(idv_phone_path) end end - - context 'with ssn_controller enabled' do - before do - allow(IdentityConfig.store).to receive(:doc_auth_ssn_controller_enabled). - and_return(true) - sign_in_and_2fa_user - complete_doc_auth_steps_before_verify_step - end - - it 'uses ssn controller to enter a new ssn and displays updated info' do - click_link t('idv.buttons.change_ssn_label') - expect(page).to have_current_path(idv_ssn_path) - - fill_in t('idv.form.ssn_label_html'), with: '900456789' - click_button t('forms.buttons.submit.update') - - expect(fake_analytics).to have_logged_event( - 'IdV: doc auth redo_ssn submitted', - ) - - expect(page).to have_current_path(idv_verify_info_path) - - expect(page).to have_text('9**-**-***9') - check t('forms.ssn.show') - expect(page).to have_text('900-45-6789') - end - end end diff --git a/spec/features/idv/doc_capture/document_capture_step_spec.rb b/spec/features/idv/doc_capture/document_capture_step_spec.rb index 515e70a4f34..96b44e0990c 100644 --- a/spec/features/idv/doc_capture/document_capture_step_spec.rb +++ b/spec/features/idv/doc_capture/document_capture_step_spec.rb @@ -62,7 +62,7 @@ using_doc_capture_session { attach_and_submit_images } click_idv_continue - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_path) expect(fake_analytics).to have_logged_event( 'IdV: doc auth document_capture submitted', hash_including( @@ -98,7 +98,7 @@ click_button t('forms.buttons.continue') end - expect(page).to have_current_path(idv_doc_auth_ssn_step, wait: 10) + expect(page).to have_current_path(idv_ssn_path, wait: 10) end end @@ -119,7 +119,7 @@ end click_idv_continue - expect(page).to have_current_path(idv_doc_auth_ssn_step) + expect(page).to have_current_path(idv_ssn_path) end it 'does not advance original session with errors' do @@ -156,7 +156,7 @@ click_button t('forms.buttons.continue') end - expect(page).to have_current_path(idv_doc_auth_ssn_step, wait: 10) + expect(page).to have_current_path(idv_ssn_path, wait: 10) end end end diff --git a/spec/features/idv/hybrid_flow_spec.rb b/spec/features/idv/hybrid_flow_spec.rb index 867f9552699..5c7cd32c1fc 100644 --- a/spec/features/idv/hybrid_flow_spec.rb +++ b/spec/features/idv/hybrid_flow_spec.rb @@ -40,6 +40,7 @@ perform_in_browser(:desktop) do expect(page).to_not have_content(t('doc_auth.headings.text_message'), wait: 10) + expect(page).to have_current_path(idv_ssn_path) fill_out_ssn_form_ok click_idv_continue @@ -60,55 +61,6 @@ end end - context 'with ssn controller enabled' do - before do - allow(IdentityConfig.store).to receive(:doc_auth_ssn_controller_enabled).and_return(true) - end - - it 'proofs and hands off to mobile', js: true do - user = nil - - perform_in_browser(:desktop) do - user = sign_in_and_2fa_user - complete_doc_auth_steps_before_send_link_step - fill_in :doc_auth_phone, with: '415-555-0199' - click_idv_continue - - expect(page).to have_content(t('doc_auth.headings.text_message')) - end - - expect(@sms_link).to be_present - - perform_in_browser(:mobile) do - visit @sms_link - attach_and_submit_images - expect(page).to have_text(t('doc_auth.instructions.switch_back')) - end - - perform_in_browser(:desktop) do - expect(page).to_not have_content(t('doc_auth.headings.text_message'), wait: 10) - expect(page).to have_current_path(idv_ssn_path) - - fill_out_ssn_form_ok - click_idv_continue - - expect(page).to have_content(t('headings.verify')) - click_idv_continue - - fill_out_phone_form_ok - verify_phone_otp - - fill_in t('idv.form.password'), with: Features::SessionHelper::VALID_PASSWORD - click_idv_continue - - acknowledge_and_confirm_personal_key - - expect(page).to have_current_path(account_path) - expect(page).to have_content(t('headings.account.verified_account')) - end - end - end - it 'shows the waiting screen correctly after cancelling from mobile and restarting', js: true do user = nil diff --git a/spec/services/idv/steps/ssn_step_spec.rb b/spec/services/idv/steps/ssn_step_spec.rb deleted file mode 100644 index 75ea852f83d..00000000000 --- a/spec/services/idv/steps/ssn_step_spec.rb +++ /dev/null @@ -1,110 +0,0 @@ -require 'rails_helper' - -describe Idv::Steps::SsnStep do - include Rails.application.routes.url_helpers - - let(:user) { build(:user) } - let(:params) { { doc_auth: {} } } - let(:session) { { sp: { issuer: service_provider.issuer } } } - let(:attempts_api) { IrsAttemptsApiTrackingHelper::FakeAttemptsTracker.new } - let(:service_provider) do - create( - :service_provider, - issuer: 'http://sp.example.com', - app_id: '123', - ) - end - let(:controller) do - instance_double( - 'controller', - session: session, - current_user: user, - params: params, - analytics: FakeAnalytics.new, - irs_attempts_api_tracker: attempts_api, - url_options: {}, - request: double( - 'request', - headers: { - 'X-Amzn-Trace-Id' => amzn_trace_id, - }, - ), - ) - end - let(:amzn_trace_id) { SecureRandom.uuid } - - let(:pii_from_doc) do - { - first_name: Faker::Name.first_name, - } - end - - let(:flow) do - Idv::Flows::DocAuthFlow.new(controller, {}, 'idv/doc_auth').tap do |flow| - flow.flow_session = { - pii_from_doc: pii_from_doc, - } - end - end - - subject(:step) do - Idv::Steps::SsnStep.new(flow) - end - - describe '#call' do - context 'with valid ssn' do - let(:ssn) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN[:ssn] } - let(:params) { { doc_auth: { ssn: ssn } } } - - it 'merges ssn into pii session value' do - step.call - - expect(flow.flow_session[:pii_from_doc][:ssn]).to eq(ssn) - end - - it 'logs attempts api event' do - expect(attempts_api).to receive(:idv_ssn_submitted).with( - ssn: ssn, - ) - step.call - end - - context 'with existing session applicant' do - let(:session) { super().merge(idv: { 'applicant' => {} }) } - - it 'clears applicant' do - step.call - - expect(session[:idv]['applicant']).to be_blank - end - end - - it 'adds a threatmetrix session id to flow session' do - step.extra_view_variables - expect(flow.flow_session[:threatmetrix_session_id]).to_not eq(nil) - end - - it 'does not change threatmetrix_session_id when updating ssn' do - step.call - session_id = flow.flow_session[:threatmetrix_session_id] - step.extra_view_variables - expect(flow.flow_session[:threatmetrix_session_id]).to eq(session_id) - end - end - - context 'when pii_from_doc is not present' do - let(:flow) do - Idv::Flows::DocAuthFlow.new(controller, {}, 'idv/doc_auth').tap do |flow| - flow.flow_session = { 'Idv::Steps::DocumentCaptureStep' => true } - end - end - - it 'marks previous step as incomplete' do - expect(flow.flow_session['Idv::Steps::DocumentCaptureStep']).to eq true - result = step.call - expect(flow.flow_session['Idv::Steps::DocumentCaptureStep']).to eq nil - expect(result.success?).to eq false - end - end - end -end diff --git a/spec/support/features/doc_auth_helper.rb b/spec/support/features/doc_auth_helper.rb index cb3ec0ddc96..d1b6042037e 100644 --- a/spec/support/features/doc_auth_helper.rb +++ b/spec/support/features/doc_auth_helper.rb @@ -57,10 +57,6 @@ def idv_doc_auth_upload_step idv_doc_auth_step_path(step: :upload) end - def idv_doc_auth_ssn_step - idv_doc_auth_step_path(step: :ssn) - end - def idv_doc_auth_document_capture_step idv_doc_auth_step_path(step: :document_capture) end