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
15 changes: 5 additions & 10 deletions app/controllers/idv/how_to_verify_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class HowToVerifyController < ApplicationController
include Idv::AvailabilityConcern
include IdvStepConcern
include RenderConditionConcern
include DocAuthVendorConcern

before_action :confirm_step_allowed
before_action :set_how_to_verify_presenter
Expand Down Expand Up @@ -64,9 +65,9 @@ def self.step_info
idv_session.service_provider&.in_person_proofing_enabled
end,
undo_step: ->(idv_session:, user:) {
idv_session.skip_doc_auth_from_how_to_verify = nil
idv_session.opted_in_to_in_person_proofing = nil
},
idv_session.skip_doc_auth_from_how_to_verify = nil
idv_session.opted_in_to_in_person_proofing = nil
},
)
end

Expand Down Expand Up @@ -96,19 +97,13 @@ def set_how_to_verify_presenter
@presenter = Idv::HowToVerifyPresenter.new(
mobile_required: @mobile_required,
selfie_check_required: @selfie_required,
passport_allowed: idv_session.passport_allowed,
)
end

def mobile_required?
idv_session.selfie_check_required ||
document_capture_session.doc_auth_vendor == Idp::Constants::Vendors::SOCURE
end

def document_capture_session
return @document_capture_session if defined?(@document_capture_session)
@document_capture_session = DocumentCaptureSession.find_by(
uuid: idv_session.document_capture_session_uuid,
)
end
end
end
23 changes: 17 additions & 6 deletions app/controllers/idv/welcome_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ class WelcomeController < ApplicationController
include StepIndicatorConcern
include DocAuthVendorConcern

before_action :confirm_step_allowed
before_action :confirm_not_rate_limited
before_action :cancel_previous_in_person_enrollments, only: :show
before_action :update_doc_auth_vendor
before_action :update_passport_allowed,
only: :show,
if: -> { IdentityConfig.store.doc_auth_passports_enabled }
Expand All @@ -20,15 +22,16 @@ def show
Funnel::DocAuth::RegisterStep.new(current_user.id, sp_session[:issuer])
.call('welcome', :view, true)

@presenter = Idv::WelcomePresenter.new(decorated_sp_session)
@presenter = Idv::WelcomePresenter.new(
decorated_sp_session:,
passport_allowed: idv_session.passport_allowed,
)
end

def update
clear_future_steps!
analytics.idv_doc_auth_welcome_submitted(**analytics_arguments)

create_document_capture_session

analytics.idv_doc_auth_welcome_submitted(**analytics_arguments)
idv_session.welcome_visited = true

redirect_to idv_agreement_url
Expand All @@ -39,10 +42,12 @@ def self.step_info
key: :welcome,
controller: self,
next_steps: [:agreement],
preconditions: ->(idv_session:, user:) { !user.gpo_verification_pending_profile? },
preconditions: ->(idv_session:, user:) { true },
undo_step: ->(idv_session:, user:) do
idv_session.welcome_visited = nil
idv_session.document_capture_session_uuid = nil
idv_session.bucketed_doc_auth_vendor = nil
idv_session.passport_allowed = nil
end,
)
end
Expand All @@ -53,6 +58,8 @@ def analytics_arguments
{
step: 'welcome',
analytics_id: 'Doc Auth',
doc_auth_vendor: idv_session.bucketed_doc_auth_vendor,
passport_allowed: idv_session.passport_allowed,
}.merge(ab_test_analytics_buckets)
end

Expand All @@ -72,10 +79,14 @@ def cancel_previous_in_person_enrollments
)
end

def update_doc_auth_vendor
doc_auth_vendor
end

def update_passport_allowed
return if !IdentityConfig.store.doc_auth_passports_enabled
return if resolved_authn_context_result.facial_match?
return if doc_auth_vendor == Idp::Constants::Vendors::SOCURE

idv_session.passport_allowed ||= begin
if dos_passport_api_healthy?(analytics:)
(ab_test_bucket(:DOC_AUTH_PASSPORT) == :passport_allowed)
Expand Down
59 changes: 36 additions & 23 deletions app/presenters/idv/how_to_verify_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,31 @@ class Idv::HowToVerifyPresenter
include ActionView::Helpers::TagHelper
include ActionView::Helpers::TranslationHelper

attr_reader :mobile_required, :selfie_required
attr_reader :mobile_required, :selfie_required, :passport_allowed

def initialize(mobile_required:, selfie_check_required:)
def initialize(mobile_required:, selfie_check_required:, passport_allowed:)
@mobile_required = mobile_required
@selfie_required = selfie_check_required
@passport_allowed = passport_allowed
end

def how_to_verify_info
if mobile_required
t('doc_auth.info.how_to_verify_mobile')
else
t('doc_auth.info.how_to_verify')
end
t('doc_auth.headings.how_to_verify')
end

def header_text
t('doc_auth.headings.how_to_verify')
end

def asset_url
def online_asset_url
if mobile_required
'idv/mobile-phone-icon.svg'
else
'idv/remote.svg'
end
end

def alt_text
def online_asset_alt_text
if mobile_required
t('image_description.phone_icon')
else
Expand All @@ -51,34 +52,46 @@ def verify_online_instruction
end

def verify_online_description
if mobile_required
t('doc_auth.info.verify_online_description_mobile')
if passport_allowed
t('doc_auth.info.verify_online_description_passport')
else
t('doc_auth.info.verify_online_description')
''
end
end

def submit
def online_submit
if mobile_required
t('forms.buttons.continue_remote_mobile')
t('forms.buttons.continue_online_mobile')
else
t('forms.buttons.continue_remote')
t('forms.buttons.continue_online')
end
end

def post_office_asset_url
'idv/in-person.svg'
end

def post_office_asset_alt_text
t('image_description.post_office')
end

def verify_at_post_office_text
t('doc_auth.headings.verify_at_post_office')
end

def post_office_instruction
if selfie_required
t('doc_auth.info.verify_at_post_office_instruction_selfie')
else
t('doc_auth.info.verify_at_post_office_instruction')
end
t('doc_auth.info.verify_at_post_office_instruction')
end

def post_office_description
if mobile_required
t('doc_auth.info.verify_at_post_office_description_mobile')
if passport_allowed
t('doc_auth.info.verify_at_post_office_description_passport_html')
else
t('doc_auth.info.verify_at_post_office_description')
''
end
end

def post_office_submit
t('forms.buttons.continue_ipp')
end
end
13 changes: 10 additions & 3 deletions app/presenters/idv/welcome_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class WelcomePresenter

attr_accessor :url_options

def initialize(decorated_sp_session)
def initialize(decorated_sp_session:, passport_allowed:)
@decorated_sp_session = decorated_sp_session
@passport_allowed = passport_allowed
@url_options = {}
end

Expand Down Expand Up @@ -45,7 +46,7 @@ def explanation_text(help_link)
def bullet_points
[
bullet_point(
t('doc_auth.instructions.bullet1'),
id_type_copy,
t('doc_auth.instructions.text1'),
),

Expand All @@ -68,12 +69,18 @@ def bullet_points

private

attr_accessor :decorated_sp_session
attr_reader :decorated_sp_session, :passport_allowed

def current_user
decorated_sp_session&.current_user
end

def id_type_copy
return t('doc_auth.instructions.bullet1b') if passport_allowed

t('doc_auth.instructions.bullet1a')
end

def bullet_point(bullet, text)
BulletPoint.new(bullet: bullet, text: text)
end
Expand Down
12 changes: 12 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2316,11 +2316,15 @@ def idv_doc_auth_warning_visited(step_name:, remaining_submit_attempts:, **extra
# User submits IdV welcome screen
# @param [String] step Current IdV step
# @param [String] analytics_id Current IdV flow identifier
# @param [String] doc_auth_vendor Vendor used for document capture
# @param [Boolean] passport_allowed Whether passport is allowed for document capture
# @param [Boolean] skip_hybrid_handoff Whether skipped hybrid handoff A/B test is active
# @param [Boolean] opted_in_to_in_person_proofing User opted into in person proofing
def idv_doc_auth_welcome_submitted(
step:,
analytics_id:,
doc_auth_vendor:,
passport_allowed:,
opted_in_to_in_person_proofing: nil,
skip_hybrid_handoff: nil,
**extra
Expand All @@ -2329,6 +2333,8 @@ def idv_doc_auth_welcome_submitted(
'IdV: doc auth welcome submitted',
step:,
analytics_id:,
doc_auth_vendor:,
passport_allowed:,
opted_in_to_in_person_proofing:,
skip_hybrid_handoff:,
**extra,
Expand All @@ -2338,11 +2344,15 @@ def idv_doc_auth_welcome_submitted(
# User visits IdV welcome screen
# @param [String] step Current IdV step
# @param [String] analytics_id Current IdV flow identifier
# @param [String] doc_auth_vendor Vendor used for document capture
# @param [Boolean] passport_allowed Whether passport is allowed for document capture
# @param [Boolean] skip_hybrid_handoff Whether skipped hybrid handoff A/B test is active
# @param [Boolean] opted_in_to_in_person_proofing User opted into in person proofing
def idv_doc_auth_welcome_visited(
step:,
analytics_id:,
doc_auth_vendor:,
passport_allowed:,
opted_in_to_in_person_proofing: nil,
skip_hybrid_handoff: nil,
**extra
Expand All @@ -2351,6 +2361,8 @@ def idv_doc_auth_welcome_visited(
'IdV: doc auth welcome visited',
step:,
analytics_id:,
doc_auth_vendor:,
passport_allowed:,
skip_hybrid_handoff:,
opted_in_to_in_person_proofing:,
**extra,
Expand Down
Loading