diff --git a/app/controllers/api/verify/password_confirm_controller.rb b/app/controllers/api/verify/password_confirm_controller.rb index 8f1d4a2fef7..eb3d8943d38 100644 --- a/app/controllers/api/verify/password_confirm_controller.rb +++ b/app/controllers/api/verify/password_confirm_controller.rb @@ -12,7 +12,7 @@ def create store_session_last_gpo_code(form.gpo_code) render json: { personal_key: personal_key, - completion_url: completion_url(result), + completion_url: completion_url(result, user), } else render_errors(result.errors) @@ -42,8 +42,10 @@ def add_proofing_component(user) ProofingComponent.create_or_find_by(user: user).update(verified_at: Time.zone.now) end - def completion_url(result) - if result.extra[:profile_pending] + def completion_url(result, user) + if in_person_enrollment?(user) + idv_in_person_ready_to_verify_url + elsif result.extra[:profile_pending] idv_come_back_later_url elsif current_sp sign_up_completed_url @@ -51,6 +53,12 @@ def completion_url(result) account_url end end + + def in_person_enrollment?(user) + return false unless IdentityConfig.store.in_person_proofing_enabled + # WILLFIX: After LG-6708 and we have enrollment saved, reference enrollment instead. + ProofingComponent.find_by(user: user)&.document_check == Idp::Constants::Vendors::USPS + end end end end diff --git a/app/controllers/idv/in_person/ready_to_verify_controller.rb b/app/controllers/idv/in_person/ready_to_verify_controller.rb new file mode 100644 index 00000000000..5fd76305579 --- /dev/null +++ b/app/controllers/idv/in_person/ready_to_verify_controller.rb @@ -0,0 +1,26 @@ +module Idv + module InPerson + class ReadyToVerifyController < ApplicationController + before_action :confirm_two_factor_authenticated + before_action :confirm_in_person_session + + def show + analytics.idv_in_person_ready_to_verify_visit + end + + private + + def confirm_in_person_session + redirect_to account_url unless in_person_proofing_component? + end + + def in_person_proofing_component? + proofing_component&.document_check == Idp::Constants::Vendors::USPS + end + + def proofing_component + ProofingComponent.find_by(user: current_user) + end + end + end +end diff --git a/app/controllers/idv/in_person_controller.rb b/app/controllers/idv/in_person_controller.rb index 3c9e1625c14..b91a6a415a5 100644 --- a/app/controllers/idv/in_person_controller.rb +++ b/app/controllers/idv/in_person_controller.rb @@ -7,7 +7,7 @@ class InPersonController < ApplicationController FSM_SETTINGS = { step_url: :idv_in_person_step_url, - final_url: :account_url, + final_url: :idv_phone_url, flow: Idv::Flows::InPersonFlow, analytics_id: 'In Person Proofing', }.freeze diff --git a/app/controllers/idv/personal_key_controller.rb b/app/controllers/idv/personal_key_controller.rb index 56e5a072eb8..ff848ce2600 100644 --- a/app/controllers/idv/personal_key_controller.rb +++ b/app/controllers/idv/personal_key_controller.rb @@ -33,7 +33,9 @@ def step_indicator_steps end def next_step - if session[:sp] && !pending_profile? + if in_person_enrollment? + idv_in_person_ready_to_verify_url + elsif session[:sp] && !pending_profile? sign_up_completed_url elsif pending_profile? && idv_session.address_verification_mechanism == 'gpo' idv_come_back_later_url @@ -72,6 +74,12 @@ def generate_personal_key idv_session.profile.encrypt_recovery_pii(cacher.fetch) end + def in_person_enrollment? + return false unless IdentityConfig.store.in_person_proofing_enabled + # WILLFIX: After LG-6708 and we have enrollment saved, reference enrollment instead. + ProofingComponent.find_by(user: current_user)&.document_check == Idp::Constants::Vendors::USPS + end + def pending_profile? current_user.pending_profile? end diff --git a/app/forms/idv/api_image_upload_form.rb b/app/forms/idv/api_image_upload_form.rb index c9ce06d895c..0641ff1ff98 100644 --- a/app/forms/idv/api_image_upload_form.rb +++ b/app/forms/idv/api_image_upload_form.rb @@ -227,8 +227,8 @@ def update_analytics(client_response) end def acuant_sdk_capture? - image_metadata.dig(:front, :source) == 'acuant' && - image_metadata.dig(:back, :source) == 'acuant' + image_metadata.dig(:front, :source) == Idp::Constants::Vendors::ACUANT && + image_metadata.dig(:back, :source) == Idp::Constants::Vendors::ACUANT end def image_metadata diff --git a/app/jobs/document_proofing_job.rb b/app/jobs/document_proofing_job.rb index 61e53fc16bb..d76809af2f6 100644 --- a/app/jobs/document_proofing_job.rb +++ b/app/jobs/document_proofing_job.rb @@ -134,8 +134,8 @@ def normalize_image_file(file_or_data_url) end def acuant_sdk_capture?(image_metadata) - image_metadata.dig(:front, :source) == 'acuant' && - image_metadata.dig(:back, :source) == 'acuant' + image_metadata.dig(:front, :source) == Idp::Constants::Vendors::ACUANT && + image_metadata.dig(:back, :source) == Idp::Constants::Vendors::ACUANT end def s3_helper diff --git a/app/services/analytics_events.rb b/app/services/analytics_events.rb index 9c3c35b107a..0ee0bc2b4c8 100644 --- a/app/services/analytics_events.rb +++ b/app/services/analytics_events.rb @@ -465,6 +465,11 @@ def idv_come_back_later_visit track_event('IdV: come back later visited') end + # The user visited the "ready to verify" page for the in person proofing flow + def idv_in_person_ready_to_verify_visit + track_event('IdV: in person ready to verify visited') + end + # @param [String] step_name which step the user was on # @param [Integer] remaining_attempts how many attempts the user has left before we throttle them # The user visited an error page due to an encountering an exception talking to a proofing vendor diff --git a/app/services/doc_auth_router.rb b/app/services/doc_auth_router.rb index c0eb91bfb0d..7376512bebd 100644 --- a/app/services/doc_auth_router.rb +++ b/app/services/doc_auth_router.rb @@ -153,7 +153,7 @@ def translate_generic_errors!(response) # @param [Proc,nil] warn_notifier proc takes a hash, and should log that hash to events.log def self.client(vendor_discriminator: nil, warn_notifier: nil) case doc_auth_vendor(discriminator: vendor_discriminator) - when 'acuant' + when Idp::Constants::Vendors::ACUANT DocAuthErrorTranslatorProxy.new( DocAuth::Acuant::AcuantClient.new( assure_id_password: IdentityConfig.store.acuant_assure_id_password, @@ -168,7 +168,7 @@ def self.client(vendor_discriminator: nil, warn_notifier: nil) glare_threshold: IdentityConfig.store.doc_auth_error_glare_threshold, ), ) - when 'lexisnexis' + when Idp::Constants::Vendors::LEXIS_NEXIS DocAuthErrorTranslatorProxy.new( DocAuth::LexisNexis::LexisNexisClient.new( account_id: IdentityConfig.store.lexisnexis_account_id, @@ -188,7 +188,7 @@ def self.client(vendor_discriminator: nil, warn_notifier: nil) glare_threshold: IdentityConfig.store.doc_auth_error_glare_threshold, ), ) - when 'mock' + when Idp::Constants::Vendors::MOCK DocAuthErrorTranslatorProxy.new( DocAuth::Mock::DocAuthMockClient.new( warn_notifier: warn_notifier, diff --git a/app/services/idv/steps/ipp/verify_step.rb b/app/services/idv/steps/ipp/verify_step.rb index 64660003d69..b3b11b051ce 100644 --- a/app/services/idv/steps/ipp/verify_step.rb +++ b/app/services/idv/steps/ipp/verify_step.rb @@ -3,14 +3,12 @@ module Steps module Ipp class VerifyStep < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def call # WILLFIX: (LG-6498) make a call to Instant Verify before allowing the user to continue save_legacy_state + add_proofing_component delete_pii - - # send the user to the phone page where they'll continue the remainder of - # the idv flow - redirect_to idv_phone_url end def extra_view_variables @@ -19,6 +17,14 @@ def extra_view_variables step_url: method(:idv_in_person_step_url), } end + + private + + def add_proofing_component + ProofingComponent. + create_or_find_by(user: current_user). + update(document_check: Idp::Constants::Vendors::USPS) + end end end end diff --git a/app/views/idv/in_person/barcode.html.erb b/app/views/idv/in_person/barcode.html.erb deleted file mode 100644 index 9a780ad8d09..00000000000 --- a/app/views/idv/in_person/barcode.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% title t('titles.doc_auth.verify') %> - -