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
8 changes: 6 additions & 2 deletions app/controllers/idv/agreement_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def update

if IdentityConfig.store.in_person_proofing_opt_in_enabled &&
IdentityConfig.store.in_person_proofing_enabled
redirect_to idv_how_to_verify_url
if params[:skip_hybrid_handoff]
redirect_to idv_choose_id_type_url
else
redirect_to idv_how_to_verify_url
end
else
redirect_to idv_hybrid_handoff_url
end
Expand All @@ -53,7 +57,7 @@ def self.step_info
Idv::StepInfo.new(
key: :agreement,
controller: self,
next_steps: [:hybrid_handoff, :document_capture, :how_to_verify],
next_steps: [:hybrid_handoff, :choose_id_type, :document_capture, :how_to_verify],
preconditions: ->(idv_session:, user:) { idv_session.welcome_visited },
undo_step: ->(idv_session:, user:) do
idv_session.idv_consent_given_at = nil
Expand Down
84 changes: 84 additions & 0 deletions app/controllers/idv/choose_id_type_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# frozen_string_literal: true

module Idv
class ChooseIdTypeController < ApplicationController
include Idv::AvailabilityConcern
include IdvStepConcern
include StepIndicatorConcern

before_action :redirect_if_passport_not_available

def show
analytics.idv_doc_auth_choose_id_type_visited(**analytics_arguments)
end

def update
clear_future_steps!

@choose_id_type_form = Idv::ChooseIdTypeForm.new

result = @choose_id_type_form.submit(choose_id_type_form_params)

analytics.idv_doc_auth_choose_id_type_submitted(
**analytics_arguments.merge(result.to_h)
.merge({ chosen_id_type: }),
)

if result.success?
set_passport_requested
redirect_to next_step
else
render :show
end
end

def self.step_info
Idv::StepInfo.new(
key: :choose_id_type,
controller: self,
next_steps: [:document_capture],
preconditions: ->(idv_session:, user:) {
idv_session.flow_path == 'standard' &&
idv_session.passport_allowed == true
},
undo_step: ->(idv_session:, user:) do
idv_session.passport_requested = nil
end,
)
end

private

def redirect_if_passport_not_available
redirect_to idv_how_to_verify_url if !idv_session.passport_allowed
end

def chosen_id_type
choose_id_type_form_params[:choose_id_type_preference]
end

def set_passport_requested
if chosen_id_type == 'passport'
idv_session.passport_requested = true
else
idv_session.passport_requested = false
end
end

def next_step
idv_document_capture_url
end

def choose_id_type_form_params
params.require(:doc_auth).permit(:choose_id_type_preference)
end

def analytics_arguments
{
step: 'choose_id_type',
analytics_id: 'Doc Auth',
flow_path: idv_session.flow_path,
}
end
end
end
12 changes: 10 additions & 2 deletions app/controllers/idv/hybrid_handoff_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def self.step_info
Idv::StepInfo.new(
key: :hybrid_handoff,
controller: self,
next_steps: [:link_sent, :document_capture, :socure_document_capture],
next_steps: [:choose_id_type, :link_sent, :document_capture, :socure_document_capture],
preconditions: ->(idv_session:, user:) {
idv_session.idv_consent_given? &&
(self.selected_remote(idv_session: idv_session) || # from opt-in screen
Expand Down Expand Up @@ -149,7 +149,7 @@ def update_document_capture_session_requested_at(session_uuid)

def bypass_send_link_steps
idv_session.flow_path = 'standard'
redirect_to vendor_document_capture_url
redirect_to next_step

analytics.idv_doc_auth_hybrid_handoff_submitted(
**analytics_arguments.merge(
Expand All @@ -158,6 +158,14 @@ def bypass_send_link_steps
)
end

def next_step
if idv_session.passport_allowed
idv_choose_id_type_url
else
idv_document_capture_url
end
end

def extra_view_variables
{ idv_phone_form: build_form }
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/idv/welcome_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class WelcomeController < ApplicationController

def show
idv_session.proofing_started_at ||= Time.zone.now.iso8601
idv_session.passport_allowed = IdentityConfig.store.doc_auth_passports_enabled
analytics.idv_doc_auth_welcome_visited(**analytics_arguments)

Funnel::DocAuth::RegisterStep.new(current_user.id, sp_session[:issuer])
Expand Down
31 changes: 31 additions & 0 deletions app/forms/idv/choose_id_type_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

module Idv
class ChooseIdTypeForm
include ActiveModel::Model

validate :chosen_id_type_valid?
attr_reader :chosen_id_type

def initialize(chosen_id_type = nil)
@chosen_id_type = chosen_id_type
end

def submit(params)
@chosen_id_type = params[:choose_id_type_preference]

FormResponse.new(success: chosen_id_type_valid?, errors: errors)
end

def chosen_id_type_valid?
valid_types = ['passport', 'drivers_license'] # Will remove once pasport added to id slugs
return true if valid_types.include? @chosen_id_type
errors.add(
:chosen_id_type,
:invalid,
message: "`choose_id_type` #{@chosen_id_type} is invalid, expected one of #{valid_types}",
)
false
end
end
end
1 change: 1 addition & 0 deletions app/policies/idv/flow_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FlowPolicy
agreement: Idv::AgreementController.step_info,
how_to_verify: Idv::HowToVerifyController.step_info,
hybrid_handoff: Idv::HybridHandoffController.step_info,
choose_id_type: Idv::ChooseIdTypeController.step_info,
link_sent: Idv::LinkSentController.step_info,
document_capture: Idv::DocumentCaptureController.step_info,
socure_document_capture: Idv::Socure::DocumentCaptureController.step_info,
Expand Down
45 changes: 45 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,51 @@ def idv_doc_auth_capture_complete_visited(
)
end

# @param [Boolean] success
# @param [String] step Current IdV step
# @param [String] analytics_id Current IdV flow identifier
# @param ["hybrid","standard"] flow_path Document capture user flow
# @param ['drivers_license', 'passport'] chosen_id_type Chosen id type of the user
# @param [Hash] error_details
def idv_doc_auth_choose_id_type_submitted(
success:,
step:,
analytics_id:,
flow_path:,
chosen_id_type:,
error_details: nil,
**extra
)
track_event(
:idv_doc_auth_choose_id_type_submitted,
success:,
step:,
analytics_id:,
flow_path:,
chosen_id_type:,
error_details:,
**extra,
)
end

# @param [String] step Current IdV step
# @param [String] analytics_id Current IdV flow identifier
# @param ["hybrid","standard"] flow_path Document capture user flow
def idv_doc_auth_choose_id_type_visited(
step:,
analytics_id:,
flow_path:,
**extra
)
track_event(
:idv_doc_auth_choose_id_type_visited,
step:,
analytics_id:,
flow_path:,
**extra,
)
end

# User returns from Socure document capture, but is waiting on a result to be fetched
# @param ["hybrid","standard"] flow_path Document capture user flow
# @param [String] step Current IdV step
Expand Down
4 changes: 4 additions & 0 deletions app/services/idv/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module Idv
# @attr idv_phone_step_document_capture_session_uuid [String, nil]
# @attr mail_only_warning_shown [Boolean, nil]
# @attr opted_in_to_in_person_proofing [Boolean, nil]
# @attr passport_allowed [Boolean, nil]
# @attr passport_requested [Boolean, nil]
# @attr personal_key [String, nil]
# @attr personal_key_acknowledged [Boolean, nil]
# @attr phone_for_mobile_flow [String, nil]
Expand Down Expand Up @@ -60,6 +62,8 @@ class Session
idv_phone_step_document_capture_session_uuid
mail_only_warning_shown
opted_in_to_in_person_proofing
passport_allowed
passport_requested
personal_key
personal_key_acknowledged
phone_for_mobile_flow
Expand Down
51 changes: 51 additions & 0 deletions app/views/idv/choose_id_type/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<% self.title = t('doc_auth.headings.choose_id_type') %>

<% content_for(:pre_flash_content) do %>
<%= render StepIndicatorComponent.new(
steps: Idv::StepIndicatorConcern::STEP_INDICATOR_STEPS,
current_step: :verify_id,
locale_scope: 'idv',
class: 'margin-x-neg-2 margin-top-neg-4 tablet:margin-x-neg-6 tablet:margin-top-neg-4',
) %>
<% end %>

<%= render PageHeadingComponent.new do %>
<%= t('doc_auth.headings.choose_id_type') %>
<% end %>

<p>
<%= t('doc_auth.info.choose_id_type') %>
</p>

<%= new_tab_link_to(
t('doc_auth.info.id_types_learn_more'),
help_center_redirect_url(
category: 'verify-your-identity',
article: 'accepted-identification-documents',
),
)
%>

<%= simple_form_for(
:doc_auth,
url: idv_choose_id_type_path,
method: :put,
) do |f| %>
<%= render ValidatedFieldComponent.new(
as: :radio_buttons,
collection: [
[t('doc_auth.forms.id_type_preference.drivers_license'), :drivers_license],
[t('doc_auth.forms.id_type_preference.passport'), :passport],
],
form: f,
input_html: { class: 'usa-radio__input--tile' },
item_label_class: 'usa-radio__label text-bold width-full margin-y-2',
name: :choose_id_type_preference,
required: true,
wrapper: :uswds_radio_buttons,
error_messages: { valueMissing: t('doc_auth.errors.choose_id_type_check') },
) %>
<%= f.submit t('forms.buttons.continue'), class: 'margin-y-2' %>
<% end %>

<%= render 'idv/doc_auth/cancel', step: 'choose_id_type' %>
6 changes: 6 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ doc_auth.errors.camera.blocked: Your camera is blocked
doc_auth.errors.camera.blocked_detail_html: '<strong>Allow access to your camera to take photos for %{app_name}.</strong><span>Try taking photos again and allowing permission. If that doesn’t work, you may need to check your device settings to allow access.</span>'
doc_auth.errors.camera.failed: Camera failed to start, please try again.
doc_auth.errors.card_type: Try again with your driver’s license or state ID card.
doc_auth.errors.choose_id_type_check: Select the type of document that you have
doc_auth.errors.consent_form: Before you can continue, you must give us permission. Please check the box below and then click continue.
doc_auth.errors.doc_type_not_supported_heading: We only accept a driver’s license or a state ID
doc_auth.errors.doc.doc_type_check: Your driver’s license or state ID must be issued by a U.S. state or territory. We do not accept other forms of ID, like passports or military IDs.
Expand Down Expand Up @@ -581,6 +582,8 @@ doc_auth.errors.upload_error: Sorry, something went wrong on our end.
doc_auth.forms.change_file: Change file
doc_auth.forms.choose_file_html: Drag file here or <lg-underline>choose from folder</lg-underline>
doc_auth.forms.doc_success: We verified your information
doc_auth.forms.id_type_preference.drivers_license: U.S. driver’s license or state ID
doc_auth.forms.id_type_preference.passport: U.S. passport book
doc_auth.forms.selected_file: Selected file
doc_auth.headers.expired_id: Your ID may have expired
doc_auth.headers.general.network_error: We are having technical difficulties
Expand All @@ -594,6 +597,7 @@ doc_auth.headings.back: Back of your driver’s license or state ID
doc_auth.headings.capture_complete: We verified your identity document
doc_auth.headings.capture_scan_warning_html: We couldn’t read the barcode on your ID. If the information below is incorrect, please %{link_html} of your state‑issued ID.
doc_auth.headings.capture_scan_warning_link: upload new photos
doc_auth.headings.choose_id_type: Choose your ID type
doc_auth.headings.document_capture: Add photos of your driver’s license or state ID card
doc_auth.headings.document_capture_back: Back of your ID
doc_auth.headings.document_capture_front: Front of your ID
Expand Down Expand Up @@ -635,6 +639,7 @@ doc_auth.info.capture_status_capturing: Capturing
doc_auth.info.capture_status_none: Align
doc_auth.info.capture_status_small_document: Move Closer
doc_auth.info.capture_status_tap_to_capture: Tap to Capture
doc_auth.info.choose_id_type: Select the type of document that you have. You’ll need to take photos of your ID to verify your identity.
doc_auth.info.exit.with_sp: Exit %{app_name} and return to %{sp_name}
doc_auth.info.exit.without_sp: Exit identity verification and go to your account page
doc_auth.info.getting_started_html: '%{sp_name} needs to make sure you are you — not someone pretending to be you. %{link_html}'
Expand All @@ -644,6 +649,7 @@ doc_auth.info.how_to_verify_mobile: You have the option to verify your identity
doc_auth.info.how_to_verify_troubleshooting_options_header: Want to learn more about how to verify your identity?
doc_auth.info.hybrid_handoff: We’ll collect information about you by reading your state‑issued ID.
doc_auth.info.hybrid_handoff_ipp_html: '<strong>Don’t have a mobile phone?</strong> You can verify your identity at a United States Post Office instead.'
doc_auth.info.id_types_learn_more: Learn more about which ID types you can use
doc_auth.info.image_loaded: Image loaded
doc_auth.info.image_loading: Image loading
doc_auth.info.image_updated: Image updated
Expand Down
6 changes: 6 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ doc_auth.errors.camera.blocked: Su cámara está bloqueada
doc_auth.errors.camera.blocked_detail_html: '<strong>Permita el acceso a su cámara para tomar las fotografías de %{app_name}.</strong><span>Intente tomar las fotografías de nuevo permitiendo el acceso. Si eso no funciona, tal vez necesite revisar la configuración de su dispositivo para permitir el acceso.</span>'
doc_auth.errors.camera.failed: No se pudo activar la cámara; inténtelo de nuevo.
doc_auth.errors.card_type: Inténtelo de nuevo con su licencia de conducir o tarjeta de identificación estatal.
doc_auth.errors.choose_id_type_check: Seleccione el tipo de documento que tenga
doc_auth.errors.consent_form: Antes de continuar, debe darnos permiso. Marque la casilla a continuación y luego haga clic en continuar.
doc_auth.errors.doc_type_not_supported_heading: Solo aceptamos una licencia de conducir o una identificación estatal.
doc_auth.errors.doc.doc_type_check: Su licencia de conducir o identificación estatal debe ser emitida por un estado o territorio de los EE. UU. No aceptamos otras formas de identificación, como pasaportes o identificaciones militares.
Expand Down Expand Up @@ -592,6 +593,8 @@ doc_auth.errors.upload_error: Lo sentimos, algo no funcionó bien.
doc_auth.forms.change_file: Cambiar archivo
doc_auth.forms.choose_file_html: Arrastrar el archivo aquí o <lg-underline>seleccionarlo de la carpeta</lg-underline>
doc_auth.forms.doc_success: Verificamos su información
doc_auth.forms.id_type_preference.drivers_license: Licencia de conducir de los EE. UU. o identificación estatal
doc_auth.forms.id_type_preference.passport: Pasaporte estadounidense
doc_auth.forms.selected_file: Archivo seleccionado
doc_auth.headers.expired_id: Su identificación puede estar vencida
doc_auth.headers.general.network_error: Estamos teniendo problemas técnicos
Expand All @@ -605,6 +608,7 @@ doc_auth.headings.back: Reverso de su licencia de conducir o identificación est
doc_auth.headings.capture_complete: Verificamos su documento de identidad
doc_auth.headings.capture_scan_warning_html: No pudimos leer el código de barras en su identificación. Si la información que aparece a continuación es incorrecta, %{link_html} de su identificación emitida por el estado.
doc_auth.headings.capture_scan_warning_link: cargue nuevas fotos
doc_auth.headings.choose_id_type: Elija el tipo de su identificación
doc_auth.headings.document_capture: Añade fotos de tu licencia de conducir o credencial de identificación oficial
doc_auth.headings.document_capture_back: Reverso de su identificación
doc_auth.headings.document_capture_front: Frente de su identificación
Expand Down Expand Up @@ -646,6 +650,7 @@ doc_auth.info.capture_status_capturing: Capturando
doc_auth.info.capture_status_none: Alinear
doc_auth.info.capture_status_small_document: Acercar
doc_auth.info.capture_status_tap_to_capture: Tocar para capturar
doc_auth.info.choose_id_type: Seleccione el tipo de documento que tenga. Tendrá que tomar fotografías de su identificación para verificar su identidad.
doc_auth.info.exit.with_sp: Salir de %{app_name} y volver a %{sp_name}
doc_auth.info.exit.without_sp: Salga de la verificación de identidad y vaya a la página de su cuenta
doc_auth.info.getting_started_html: '%{sp_name} necesita asegurarse de que se trata de usted y no de alguien que se hace pasar por usted. %{link_html}'
Expand All @@ -655,6 +660,7 @@ doc_auth.info.how_to_verify_mobile: Tiene la opción de verificar su identidad e
doc_auth.info.how_to_verify_troubleshooting_options_header: ¿Desea obtener más información sobre cómo verificar su identidad?
doc_auth.info.hybrid_handoff: Recopilaremos información sobre usted leyendo su identificación emitida por el estado.
doc_auth.info.hybrid_handoff_ipp_html: '<strong>¿No tiene un teléfono móvil?</strong> Puede verificar su identidad en una oficina de correos de los Estados Unidos.'
doc_auth.info.id_types_learn_more: Obtenga más información acerca de los tipos de identificación que puede usar
doc_auth.info.image_loaded: Imagen cargada
doc_auth.info.image_loading: Cargando la imagen
doc_auth.info.image_updated: Imagen actualizada
Expand Down
Loading