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
4 changes: 2 additions & 2 deletions app/controllers/concerns/idv/choose_id_type_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def dos_passport_api_healthy?(
response.success?
end

def locals_attrs(analytics:, presenter:, url_for: nil)
def locals_attrs(analytics:, presenter:, form_submit_url: nil)
dos_passport_api_down = !dos_passport_api_healthy?(analytics:)
{
presenter:,
url_for:,
form_submit_url:,
dos_passport_api_down:,
auto_check_value: dos_passport_api_down ? :drivers_license : selected_id_type,
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/choose_id_type_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def show
locals: locals_attrs(
analytics:,
presenter: Idv::ChooseIdTypePresenter.new,
url_for: idv_choose_id_type_path,
form_submit_url: idv_choose_id_type_path,
),
layout: true
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/document_capture_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def self.step_info
Idv::StepInfo.new(
key: :document_capture,
controller: self,
next_steps: [:ssn, :ipp_state_id],
next_steps: [:ssn, :ipp_state_id, :ipp_choose_id_type],
preconditions: ->(idv_session:, user:) {
idv_session.flow_path == 'standard' && (
# mobile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def show
locals: locals_attrs(
analytics:,
presenter: Idv::HybridMobile::ChooseIdTypePresenter.new,
url_for: idv_hybrid_mobile_choose_id_type_path,
form_submit_url: idv_hybrid_mobile_choose_id_type_path,
)
end

Expand Down
51 changes: 48 additions & 3 deletions app/controllers/idv/in_person/choose_id_type_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,48 @@ def show
analytics.idv_in_person_proofing_choose_id_type_visited(**analytics_arguments)

render 'idv/shared/choose_id_type',
locals: locals_attrs(analytics:, presenter: Idv::InPerson::ChooseIdTypePresenter.new),
locals: locals_attrs(
analytics:,
presenter: Idv::InPerson::ChooseIdTypePresenter.new,
form_submit_url: idv_in_person_choose_id_type_url,
),
layout: true
end

def update
clear_future_steps!

form = Idv::ChooseIdTypeForm.new
result = form.submit(allowed_params)

analytics.idv_in_person_proofing_choose_id_type_submitted(
**analytics_arguments
.merge(**result.to_h)
.merge(chosen_id_type: form.chosen_id_type),
)

if result.success?
set_chosen_id_type
redirect_to chosen_id_type_url(form.chosen_id_type)
else
redirect_to idv_in_person_choose_id_type_url
end
end

def self.step_info
Idv::StepInfo.new(
key: :ipp_choose_id_type,
controller: self,
next_steps: [],
next_steps: [:ipp_state_id],
preconditions: ->(idv_session:, user:) {
idv_session.in_person_passports_allowed? && user.has_establishing_in_person_enrollment?
},
undo_step: -> {},
undo_step: ->(idv_session:, user:) do
if idv_session.document_capture_session_uuid
DocumentCaptureSession.find_by(uuid: idv_session.document_capture_session_uuid)
&.update!(passport_status: idv_session.passport_allowed ? 'allowed' : nil)
end
end,
)
end

Expand All @@ -40,4 +66,23 @@ def analytics_arguments
}.merge(ab_test_analytics_buckets)
.merge(extra_analytics_properties)
end

def allowed_params
choose_id_type_form_params
end

def chosen_id_type_url(type)
id_type_to_route_url[type]
end

def id_type_to_route_url
{
'passport' => idv_in_person_passport_url,
'drivers_license' => idv_in_person_state_id_url,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: let's align this language with other parts of the code (see: idv/document_capture_concern.rb#L139). In this case, we are moving away from drivers_license for internal use. (I may have missed this in previous PRs, but we should try to rectify the language where we can.)

Suggested change
'drivers_license' => idv_in_person_state_id_url,
'state_id' => idv_in_person_state_id_url,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this change. I just need to get approval from @amirbey for this change. It was an existing thing in the ChooseIdTypeConcern that came from existing code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to follow up in a separate work item to unblock this one:
https://cm-jira.usa.gov/browse/LG-16162

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to make a separate task for this comment. https://cm-jira.usa.gov/browse/LG-16162

}
end

def set_chosen_id_type
set_passport_requested
end
end
6 changes: 6 additions & 0 deletions app/controllers/idv/in_person/passport_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

class Idv::InPerson::PassportController < ApplicationController
def show
end
end
33 changes: 33 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3115,6 +3115,39 @@ def idv_in_person_proofing_address_visited(
)
end

# @param [Boolean] success
# @param ["hybrid","standard"] flow_path Document capture user flow
# @param [String] step Current IdV step
# @param [String] analytics_id Current IdV flow identifier
# @param ['drivers_license', 'passport'] chosen_id_type Chosen id type of the user
# @param [Boolean] opted_in_to_in_person_proofing Whether user opted into in person proofing
# @param [Boolean] skip_hybrid_handoff Whether skipped hybrid handoff A/B test is active
# @param [Hash] error_details
def idv_in_person_proofing_choose_id_type_submitted(
success:,
flow_path:,
step:,
analytics_id:,
chosen_id_type:,
opted_in_to_in_person_proofing: nil,
skip_hybrid_handoff: nil,
error_details: nil,
**extra
)
track_event(
:idv_in_person_proofing_choose_id_type_submitted,
success:,
flow_path:,
step:,
analytics_id:,
chosen_id_type:,
opted_in_to_in_person_proofing:,
skip_hybrid_handoff:,
error_details:,
**extra,
)
end

# @param ["hybrid","standard"] flow_path Document capture user flow
# @param [String] step Current IdV step
# @param [String] analytics_id
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/shared/choose_id_type.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<%= simple_form_for(
:doc_auth,
url: url_for,
url: form_submit_url,
method: :put,
) do |f| %>
<%= render ValidatedFieldComponent.new(
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
put '/in_person' => 'in_person#update'
get '/in_person/choose_id_type' => 'in_person/choose_id_type#show'
put '/in_person/choose_id_type' => 'in_person/choose_id_type#update'
get '/in_person/passport' => 'in_person/passport#show'
get '/in_person/ready_to_verify' => 'in_person/ready_to_verify#show',
as: :in_person_ready_to_verify
post '/in_person/usps_locations' => 'in_person/usps_locations#index'
Expand Down
Loading