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
7 changes: 4 additions & 3 deletions app/views/verify/address/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ p
.sm-col.sm-col-12.md-col-6
= link_to t('idv.buttons.activate_by_phone'), verify_phone_path,
class: 'btn btn-primary mb2 center inline-block'
.sm-col.sm-col-12.md-col-6
= link_to t('idv.buttons.activate_by_mail'), verify_usps_path,
class: 'btn btn-outline rounded-lg mb2 center'
- if FeatureManagement.enable_usps_verification?
.sm-col.sm-col-12.md-col-6
= link_to t('idv.buttons.activate_by_mail'), verify_usps_path,
class: 'btn btn-outline rounded-lg mb2 center'

= render 'shared/cancel', link: verify_cancel_path
3 changes: 3 additions & 0 deletions app/views/verify/phone/_verification_options.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
p
= t('idv.form.no_alternate_phone_html',
link: link_to(t('idv.form.activate_by_mail'), verify_usps_path))
5 changes: 2 additions & 3 deletions app/views/verify/phone/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ em
wrapper_html: { class: 'inline-block mr2' }
= f.button :submit, t('forms.buttons.continue')

p
= t('idv.form.no_alternate_phone_html',
link: link_to(t('idv.form.activate_by_mail'), verify_usps_path))
- if FeatureManagement.enable_usps_verification?
= render 'verification_options'

= render @view_model.modal_partial, view_model: @view_model
3 changes: 3 additions & 0 deletions config/application.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ development:
domain_name: 'localhost:3000'
enable_identity_verification: 'true'
enable_test_routes: 'true'
enable_usps_verification: 'true'
equifax_avs_username: 'sekret'
equifax_eid_username: 'sekret'
equifax_endpoint: 'sekret'
Expand Down Expand Up @@ -109,6 +110,7 @@ production:
domain_name: 'example.com'
enable_identity_verification: 'false'
enable_test_routes: 'false'
enable_usps_verification: 'false'
equifax_avs_username: 'sekret'
equifax_eid_username: 'sekret'
equifax_endpoint: 'sekret'
Expand Down Expand Up @@ -161,6 +163,7 @@ test:
dashboard_api_token: '123ABC'
enable_identity_verification: 'true'
enable_test_routes: 'true'
enable_usps_verification: 'true'
equifax_avs_username: 'sekret'
equifax_eid_username: 'sekret'
equifax_endpoint: 'sekret'
Expand Down
1 change: 1 addition & 0 deletions config/initializers/figaro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'domain_name',
'enable_identity_verification',
'enable_test_routes',
'enable_usps_verification',
'equifax_ssh_passphrase',
'hmac_fingerprinter_key',
'idp_sso_target_url',
Expand Down
8 changes: 6 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
get '/account' => 'accounts#show'
get '/account/reactivate' => 'users/reactivate_account#index', as: :reactivate_account
post '/account/reactivate' => 'users/reactivate_account#create'
get '/account/verify' => 'users/verify_account#index', as: :verify_account
post '/account/verify' => 'users/verify_account#create'
get '/account/verify_phone' => 'users/verify_profile_phone#index', as: :verify_profile_phone
post '/account/verify_phone' => 'users/verify_profile_phone#create'

Expand Down Expand Up @@ -135,6 +133,12 @@
put '/verify/session' => 'verify/sessions#create'
delete '/verify/session' => 'verify/sessions#destroy'
get '/verify/session/dupe' => 'verify/sessions#dupe'

end

if FeatureManagement.enable_usps_verification?
get '/account/verify' => 'users/verify_account#index', as: :verify_account
post '/account/verify' => 'users/verify_account#create'
get '/verify/usps' => 'verify/usps#index'
put '/verify/usps' => 'verify/usps#create'
end
Expand Down
4 changes: 4 additions & 0 deletions lib/feature_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def self.enable_identity_verification?
Figaro.env.enable_identity_verification == 'true'
end

def self.enable_usps_verification?
Figaro.env.enable_usps_verification == 'true'
end

def self.reveal_usps_code?
Rails.env.development? || current_env_allowed_to_see_usps_code?
end
Expand Down
1 change: 0 additions & 1 deletion spec/features/openid_connect/openid_connect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@

it 'prompts to finish verifying profile, then redirects to SP' do
allow(FeatureManagement).to receive(:reveal_usps_code?).and_return(true)

visit oidc_auth_url

sign_in_live_with_2fa(user)
Expand Down
2 changes: 0 additions & 2 deletions spec/routing/id_verification_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
verify/review
verify/session
verify/session/dupe
verify/usps
].freeze

PUT_ROUTES = %w[
verify/finance
verify/phone
verify/review
verify/session
verify/usps
].freeze

DELETE_ROUTES = %w[
Expand Down
69 changes: 69 additions & 0 deletions spec/routing/usps_verification_routing.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
require 'rails_helper'

describe 'USPS verification routes' do
GET_ROUTES = %w[
account/verify
verify/usps
].freeze

CREATE_ROUTES = %w[
account/verify
].freeze

PUT_ROUTES = %w[
verify/usps
].freeze

context 'when FeatureManagement.enable_usps_verification? is false' do
before do
allow(Figaro.env).to receive(:enable_identity_verification).and_return('false')
Rails.application.reload_routes!
end

after(:all) do
Rails.application.reload_routes!
end

it 'does not route to endpoints controlled by feature flag' do
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.

s/does not route/routes

GET_ROUTES.each do |route|
expect(get: route).
to route_to(controller: 'pages', action: 'page_not_found', path: route)
end

CREATE_ROUTES.each do |route|
expect(post: route).
to route_to(controller: 'pages', action: 'page_not_found', path: route)
end

PUT_ROUTES.each do |route|
expect(put: route).
to route_to(controller: 'pages', action: 'page_not_found', path: route)
end
end
end

context 'when FeatureManagement.enable_usps_verification? is true' do
before do
allow(Figaro.env).to receive(:enable_identity_verification).and_return('true')
Rails.application.reload_routes!
end

after(:all) do
Rails.application.reload_routes!
end

it 'routes to endpoints controlled by feature flag' do
GET_ROUTES.each do |route|
expect(get: route).to be_routable
end

CREATE_ROUTES.each do |route|
expect(post: route).to be_routable
end

PUT_ROUTES.each do |route|
expect(put: route).to be_routable
end
end
end
end