-
Notifications
You must be signed in to change notification settings - Fork 166
LG-7014 Device Profiling on the SSN page #6694
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
Changes from 19 commits
719b9a1
84ddc25
01ebbda
2908bc7
ddd0ef0
227a018
e20904d
1b6047b
32a885b
10ecc4e
82ee43c
aec8ab8
a14ee08
7060439
75516f4
b6f5357
0272f7c
b2bf717
c940d22
0f6ebc5
d09f775
13b089e
5ced292
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,15 @@ def call | |
| return invalid_state_response if invalid_state? | ||
|
|
||
| flow_session[:pii_from_doc][:ssn] = flow_params[:ssn] | ||
|
|
||
| flow_session[:threatmetrix_session_id] = threatmetrix_session_id unless updating_ssn | ||
|
|
||
| idv_session.delete('applicant') | ||
| end | ||
|
|
||
| def extra_view_variables | ||
| { | ||
| updating_ssn: flow_session.dig(:pii_from_doc, :ssn).present?, | ||
| updating_ssn: updating_ssn, | ||
| } | ||
| end | ||
|
|
||
|
|
@@ -26,10 +29,19 @@ def invalid_state? | |
| flow_session[:pii_from_doc].nil? | ||
| end | ||
|
|
||
| def updating_ssn | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's file a FIXME ticket and see if we can find a way to share code with these two SSN steps? In case we ever add a 3rd? |
||
| flow_session.dig(:pii_from_doc, :ssn).present? | ||
| end | ||
|
|
||
| def invalid_state_response | ||
| mark_step_incomplete(:document_capture) | ||
| FormResponse.new(success: false) | ||
| end | ||
|
|
||
| def threatmetrix_session_id | ||
| return nil if !IdentityConfig.store.proofing_device_profiling_collecting_enabled | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, do we need to check |
||
| SecureRandom.uuid | ||
| end | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,17 @@ locals: | |||||
| <%= new_window_link_to(t('doc_auth.instructions.learn_more'), MarketingSite.security_and_privacy_practices_url) %> | ||||||
| </p> | ||||||
|
|
||||||
| <% if IdentityConfig.store.proofing_device_profiling_collecting_enabled %> | ||||||
| <% unless IdentityConfig.store.lexisnexis_threatmetrix_org_id.empty? || updating_ssn %> | ||||||
| <script type="text/javascript" src="https://h.online-metrix.net/fp/tags.js?org_id=<%= IdentityConfig.store.lexisnexis_threatmetrix_org_id %>&session_id=<%= flow_session[:threatmetrix_session_id] %>"> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Questions, maybe we can address in a follow-up PR later, but:
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another thought, we may want to turn the domain into a config value but that's not needed right now
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll create a follow up ticket for these. |
||||||
| </script> | ||||||
| <noscript> | ||||||
| <iframe style="width: 100px; height: 100px; border: 0; position: absolute; top: -5000px;" src="https://h.online-metrix.net/fp/tags?org_id=<%= IdentityConfig.store.lexisnexis_threatmetrix_org_id %>&session_id=<%= flow_session[:threatmetrix_session_id] %>"> | ||||||
| </iframe> | ||||||
| </noscript> | ||||||
| <% end %> | ||||||
| <% end %> | ||||||
|
|
||||||
| <% if IdentityConfig.store.proofer_mock_fallback %> | ||||||
| <div class="usa-alert usa-alert--info margin-bottom-4" role="status"> | ||||||
| <div class="usa-alert__body"> | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| require 'rails_helper' | ||
|
|
||
| describe 'idv/shared/_ssn.html.erb' do | ||
| include Devise::Test::ControllerHelpers | ||
|
|
||
| let(:proofing_device_profiling_collecting_enabled) { nil } | ||
| let(:lexisnexis_threatmetrix_org_id) { 'test_org_id' } | ||
| let(:session_id) { 'ABCD-1234' } | ||
| let(:updating_ssn) { false } | ||
| let(:js_domain) { 'h.online-metrix.net' } | ||
|
|
||
| let(:tags_js_url) { | ||
| "https://#{js_domain}/fp/tags.js?org_id=#{lexisnexis_threatmetrix_org_id}&session_id=#{session_id}" | ||
| } | ||
|
|
||
| let(:tags_iframe_url) { | ||
| "https://#{js_domain}/fp/tags?org_id=#{lexisnexis_threatmetrix_org_id}&session_id=#{session_id}" | ||
| } | ||
|
|
||
| before :each do | ||
| allow(view).to receive(:url_for).and_return('https://example.com/') | ||
|
|
||
| allow(IdentityConfig.store). | ||
| to receive(:proofing_device_profiling_collecting_enabled). | ||
| and_return(proofing_device_profiling_collecting_enabled) | ||
| allow(IdentityConfig.store). | ||
| to receive(:lexisnexis_threatmetrix_org_id).and_return(lexisnexis_threatmetrix_org_id) | ||
|
|
||
| render partial: 'idv/shared/ssn', locals: { | ||
| flow_session: { | ||
| threatmetrix_session_id: session_id, | ||
| }, | ||
| success_alert_enabled: false, | ||
| updating_ssn: updating_ssn, | ||
| } | ||
| end | ||
|
|
||
| context 'when threatmetrix collection enabled' do | ||
| let(:proofing_device_profiling_collecting_enabled) { true } | ||
|
|
||
| context 'and org id specified' do | ||
| context 'and entering ssn for the first time' do | ||
| describe '<script> tag' do | ||
| it 'is rendered' do | ||
| expect_script_tag_rendered | ||
| end | ||
| end | ||
|
|
||
| describe '<noscript> tag' do | ||
| it 'is rendered' do | ||
| expect_noscript_tag_rendered | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'updating ssn already entered' do | ||
| let(:updating_ssn) { true } | ||
|
|
||
| it 'does not render <script> tag' do | ||
| expect_script_tag_not_rendered | ||
| end | ||
| it 'does not render <noscript> tag' do | ||
| expect_noscript_tag_not_rendered | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'org id not specified' do | ||
| let(:lexisnexis_threatmetrix_org_id) { '' } | ||
|
|
||
| it 'does not render <script> tag' do | ||
| expect_script_tag_not_rendered | ||
| end | ||
| it 'does not render <noscript> tag' do | ||
| expect_noscript_tag_not_rendered | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'threatmetrix collection disabled' do | ||
| let(:proofing_device_profiling_collecting_enabled) { false } | ||
|
|
||
| it 'does not render <script> tag' do | ||
| expect_script_tag_not_rendered | ||
| end | ||
| it 'does not render <noscript> tag' do | ||
| expect_noscript_tag_not_rendered | ||
| end | ||
| end | ||
|
|
||
| def expect_script_tag_rendered | ||
| expect(rendered).to have_css("script[src='#{tags_js_url}']", visible: false) | ||
| end | ||
|
|
||
| def expect_noscript_tag_rendered | ||
| expect(rendered).to have_css("noscript iframe[src='#{tags_iframe_url}']", visible: false) | ||
| end | ||
|
|
||
| def expect_session_id_input_rendered | ||
| expect(rendered). | ||
| to have_css( | ||
| "input[type=hidden][name='doc_auth[threatmetrix_session_id]'][value='#{session_id}']", | ||
| visible: false, | ||
| ) | ||
| end | ||
|
|
||
| def expect_script_tag_not_rendered | ||
| expect(rendered).not_to have_css("script[src*='#{js_domain}']", visible: false) | ||
| end | ||
|
|
||
| def expect_noscript_tag_not_rendered | ||
| expect(rendered).not_to have_css("noscript iframe[src*='#{js_domain}']", visible: false) | ||
| end | ||
|
|
||
| def expect_session_id_input_not_rendered | ||
| expect(rendered). | ||
| not_to have_css('input[name="doc_auth[threatmetrix_session_id]"]', visible: false) | ||
| end | ||
| end |
Uh oh!
There was an error while loading. Please reload this page.