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
14 changes: 11 additions & 3 deletions app/controllers/api/verify/password_confirm_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -42,15 +42,23 @@ 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
else
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
26 changes: 26 additions & 0 deletions app/controllers/idv/in_person/ready_to_verify_controller.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion app/controllers/idv/in_person_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/idv/personal_key_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/forms/idv/api_image_upload_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/document_proofing_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions app/services/doc_auth_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
14 changes: 10 additions & 4 deletions app/services/idv/steps/ipp/verify_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 0 additions & 15 deletions app/views/idv/in_person/barcode.html.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/idv/in_person/ready_to_verify/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% title t('in_person_proofing.headings.barcode') %>

<%= render PageHeadingComponent.new.with_content(t('in_person_proofing.headings.barcode')) %>
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@
put '/capture_doc/:step' => 'capture_doc#update'

get '/in_person' => 'in_person#index'
get '/in_person/ready_to_verify' => 'in_person/ready_to_verify#show',
as: :in_person_ready_to_verify
get '/in_person/:step' => 'in_person#show', as: :in_person_step
put '/in_person/:step' => 'in_person#update'

Expand Down
7 changes: 7 additions & 0 deletions lib/idp/constants.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
module Idp
module Constants
module Vendors
ACUANT = 'acuant'
LEXIS_NEXIS = 'lexisnexis'
MOCK = 'mock'
USPS = 'usps'
end

DEFAULT_IAL = 1
IAL_MAX = 0
IAL1 = 1
Expand Down
15 changes: 15 additions & 0 deletions spec/controllers/api/verify/password_confirm_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ def stub_idv_session
expect(response.status).to eq 400
end

context 'with in person profile' do
before do
ProofingComponent.create(user: user, document_check: Idp::Constants::Vendors::USPS)
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
end

it 'creates a profile and returns completion url' do
post :create, params: { password: password, user_bundle_token: jwt }

expect(JSON.parse(response.body)['completion_url']).to eq(
idv_in_person_ready_to_verify_url,
)
end
end

context 'with associated sp session' do
before do
session[:sp] = { issuer: create(:service_provider).issuer }
Expand Down
40 changes: 40 additions & 0 deletions spec/controllers/idv/in_person/ready_to_verify_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'rails_helper'

describe Idv::InPerson::ReadyToVerifyController do
let(:user) { create(:user) }

before do
stub_analytics
stub_sign_in(user)
end

describe 'before_actions' do
it 'includes authentication before_action' do
expect(subject).to have_actions(:before, :confirm_two_factor_authenticated)
end
end

describe '#show' do
subject(:response) { get :show }

it 'redirects to account page' do
expect(response).to redirect_to account_url
end

context 'with in person proofing component' do
before do
ProofingComponent.create(user: user, document_check: Idp::Constants::Vendors::USPS)
end

it 'renders show template' do
expect(response).to render_template :show
end

it 'logs analytics' do
response

expect(@analytics).to have_logged_event('IdV: in person ready to verify visited')
end
end
end
end
13 changes: 13 additions & 0 deletions spec/controllers/idv/personal_key_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,18 @@ def index
expect(response).to redirect_to idv_come_back_later_path
end
end

context 'with in person profile' do
before do
ProofingComponent.create(user: user, document_check: Idp::Constants::Vendors::USPS)
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
end

it 'creates a profile and returns completion url' do
patch :update

expect(response).to redirect_to idv_in_person_ready_to_verify_url
end
end
end
end
4 changes: 2 additions & 2 deletions spec/features/idv/in_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
expect(page).to have_content(t('titles.idv.personal_key'))
acknowledge_and_confirm_personal_key

# returns to account page
expect(page).to have_content(t('headings.account.login_info'))
# ready to verify page
expect(page).to have_content(t('in_person_proofing.headings.barcode'))
end

def attach_images_that_fail
Expand Down
6 changes: 6 additions & 0 deletions spec/services/idv/steps/ipp/verify_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,11 @@
expect(flow.idv_session).to have_key 'applicant'
expect(flow.idv_session['applicant']).to include(pii)
end

it 'updates proofing component vendor' do
step.call

expect(user.proofing_component.document_check).to eq Idp::Constants::Vendors::USPS
end
end
end