-
Notifications
You must be signed in to change notification settings - Fork 167
LG-15436 new choose id screen #11936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
69ad7db
create choose_id_type_controller
theabrad a5b464a
create choose_id_type page
theabrad 3e4da07
add flow policy for choose_id_type and allow redirects to id page
theabrad 0ea95de
use idv_session variables for passports
theabrad 3f20773
add analytics events and form error messages
theabrad c84fb27
create specs
theabrad 19f907f
styling for radio button
theabrad 2f093a9
lint fixes
theabrad 19b9dba
add changelog
theabrad 8bffa96
Updated page styling
AShukla-GSA 302bf12
switching to usa-radio__input--tile
AShukla-GSA b5ef684
Added spacing
AShukla-GSA 1bf8abd
Updating spacing
AShukla-GSA 81c332e
Adding choose id to mobile flow
AShukla-GSA df47f4e
Fixing specs and mobile flow
AShukla-GSA b37dd12
updating specs for new behaviours
AShukla-GSA c6d86ca
Resolving PR comment
AShukla-GSA 7dc6d39
Resolving PR comment
AShukla-GSA 693159f
Resolved PR comments, fixing specs
AShukla-GSA f85da82
Fixing specs
AShukla-GSA 8c8f5e6
Fixing lint and feature tests
AShukla-GSA 9b76e60
Updated spec to choose radio option and continue to doc capture
AShukla-GSA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( | ||
AShukla-GSA marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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' %> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.