@@ -45,6 +54,7 @@ locals:
html: { autocomplete: 'off' },
) do |f| %>
+ <%= f.hidden_field :session_id, value: "[SESSION_ID]" %>
<%= render 'shared/ssn_field', f: f %>
From 01ebbda1b4c5d5bc07541a11d18a3f64c3205450 Mon Sep 17 00:00:00 2001
From: Matt Hinz
Date: Tue, 2 Aug 2022 15:55:12 -0700
Subject: [PATCH 03/21] Add speculative tests for ThreatMetrix integration
Basic tests around inclusion / non-inclusion of the TM
<% end %>
@@ -54,7 +54,7 @@ locals:
html: { autocomplete: 'off' },
) do |f| %>
- <%= f.hidden_field :session_id, value: "[SESSION_ID]" %>
+ <%= f.hidden_field :session_id, value: threatmetrix_session_id %>
<%= render 'shared/ssn_field', f: f %>
From ddd0ef069ae9201655098d406497db2a7993850c Mon Sep 17 00:00:00 2001
From: Matt Hinz
Date: Wed, 3 Aug 2022 11:12:25 -0700
Subject: [PATCH 05/21] Update ThreatMetrix JS include tests
Get _most_ of them passing
---
app/views/idv/shared/_ssn.html.erb | 6 +++---
spec/views/idv/shared/_ssn.html.erb_spec.rb | 11 +++++------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/app/views/idv/shared/_ssn.html.erb b/app/views/idv/shared/_ssn.html.erb
index edf184affdf..e0e07933e21 100644
--- a/app/views/idv/shared/_ssn.html.erb
+++ b/app/views/idv/shared/_ssn.html.erb
@@ -29,10 +29,10 @@ locals:
<% if IdentityConfig.store.proofing_device_profiling_collecting_enabled %>
-
<% end %>
@@ -54,7 +54,7 @@ locals:
html: { autocomplete: 'off' },
) do |f| %>
- <%= f.hidden_field :session_id, value: threatmetrix_session_id %>
+ <%= f.hidden_field :threatmetrix_session_id, value: threatmetrix_session_id %>
<%= render 'shared/ssn_field', f: f %>
diff --git a/spec/views/idv/shared/_ssn.html.erb_spec.rb b/spec/views/idv/shared/_ssn.html.erb_spec.rb
index 3dfcd09ff60..9100d8efada 100644
--- a/spec/views/idv/shared/_ssn.html.erb_spec.rb
+++ b/spec/views/idv/shared/_ssn.html.erb_spec.rb
@@ -18,7 +18,6 @@
"https://#{js_domain}/fp/tags?org_id=#{lexisnexis_threatmetrix_account_id}&session_id=#{session_id}"
}
-
let (:script_tag_rendered) {
expect(rendered).to have_css("script[src='#{tags_js_url}']", :visible => false)
}
@@ -28,7 +27,7 @@
}
let (:session_id_input_rendered) {
- expect(rendered).to have_css("input[type=hidden][name='session_id'][value='#{session_id}']", :visible => false)
+ expect(rendered).to have_css("input[type=hidden][name='doc_auth[threatmetrix_session_id]'][value='#{session_id}']", :visible => false)
}
let (:script_tag_not_rendered) {
@@ -40,19 +39,19 @@
}
let (:session_id_input_not_rendered) {
- expect(rendered).not_to have_css('input[name="session_id"]', :visible => false)
+ expect(rendered).not_to have_css('input[name="doc_auth[threatmetrix_session_id]"]', :visible => false)
}
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(:proofing_device_profiling_collecting_enabled).and_return(proofing_device_profiling_collecting_enabled)
allow(IdentityConfig.store).to receive(:lexisnexis_threatmetrix_account_id).and_return(lexisnexis_threatmetrix_account_id)
render partial: 'idv/shared/ssn', locals: {
flow_session: {},
success_alert_enabled: false,
-
- session_id: session_id,
+ threatmetrix_session_id: session_id,
updating_ssn: updating_ssn,
}
end
From 227a018664432680bab286acaf37beea0a9f5ae9 Mon Sep 17 00:00:00 2001
From: Alex Bradley
Date: Thu, 4 Aug 2022 13:51:03 -0400
Subject: [PATCH 06/21] Fix linting errors. Make tests pass
---
app/views/idv/shared/_ssn.html.erb | 12 +++--
spec/views/idv/shared/_ssn.html.erb_spec.rb | 53 ++++++++++++---------
2 files changed, 39 insertions(+), 26 deletions(-)
diff --git a/app/views/idv/shared/_ssn.html.erb b/app/views/idv/shared/_ssn.html.erb
index e0e07933e21..f3840689007 100644
--- a/app/views/idv/shared/_ssn.html.erb
+++ b/app/views/idv/shared/_ssn.html.erb
@@ -28,13 +28,15 @@ locals:
<%= new_window_link_to(t('doc_auth.instructions.learn_more'), MarketingSite.security_and_privacy_practices_url) %>
-<% if IdentityConfig.store.proofing_device_profiling_collecting_enabled %>
-
+ <% end %>
<% end %>
<% if IdentityConfig.store.proofer_mock_fallback %>
@@ -54,7 +56,11 @@ locals:
html: { autocomplete: 'off' },
) do |f| %>
- <%= f.hidden_field :threatmetrix_session_id, value: threatmetrix_session_id %>
+ <% if IdentityConfig.store.proofing_device_profiling_collecting_enabled && !updating_ssn %>
+ <% unless IdentityConfig.store.lexisnexis_threatmetrix_account_id.empty? %>
+ <%= f.hidden_field :threatmetrix_session_id, value: threatmetrix_session_id %>
+ <% end %>
+ <% end %>
<%= render 'shared/ssn_field', f: f %>
diff --git a/spec/views/idv/shared/_ssn.html.erb_spec.rb b/spec/views/idv/shared/_ssn.html.erb_spec.rb
index 9100d8efada..a4818a9565a 100644
--- a/spec/views/idv/shared/_ssn.html.erb_spec.rb
+++ b/spec/views/idv/shared/_ssn.html.erb_spec.rb
@@ -2,51 +2,58 @@
describe 'idv/shared/_ssn.html.erb' do
include Devise::Test::ControllerHelpers
-
+
let(:proofing_device_profiling_collecting_enabled) { nil }
- let(:lexisnexis_threatmetrix_account_id) { 'test_org_id'}
- let(:session_id) { "ABCD-1234" }
+ let(:lexisnexis_threatmetrix_account_id) { 'test_org_id' }
+ let(:session_id) { 'ABCD-1234' }
let(:updating_ssn) { false }
-
- let (:js_domain) { "h.online-metrix.net"}
+ let(:js_domain) { 'h.online-metrix.net' }
- let (:tags_js_url) {
+ let(:tags_js_url) {
"https://#{js_domain}/fp/tags.js?org_id=#{lexisnexis_threatmetrix_account_id}&session_id=#{session_id}"
}
- let (:tags_iframe_url) {
+ let(:tags_iframe_url) {
"https://#{js_domain}/fp/tags?org_id=#{lexisnexis_threatmetrix_account_id}&session_id=#{session_id}"
}
- let (:script_tag_rendered) {
- expect(rendered).to have_css("script[src='#{tags_js_url}']", :visible => false)
+ let(:script_tag_rendered) {
+ expect(rendered).to have_css("script[src='#{tags_js_url}']", visible: false)
}
- let (:noscript_tag_rendered) {
- expect(rendered).to have_css("noscript iframe[src='#{tags_iframe_url}']", :visible => false)
+ let(:noscript_tag_rendered) {
+ expect(rendered).to have_css("noscript iframe[src='#{tags_iframe_url}']", visible: false)
}
- let (:session_id_input_rendered) {
- expect(rendered).to have_css("input[type=hidden][name='doc_auth[threatmetrix_session_id]'][value='#{session_id}']", :visible => false)
+ let(:session_id_input_rendered) {
+ expect(rendered).
+ to have_css(
+ "input[type=hidden][name='doc_auth[threatmetrix_session_id]'][value='#{session_id}']",
+ visible: false,
+ )
}
- let (:script_tag_not_rendered) {
- expect(rendered).not_to have_css("script[src*='#{js_domain}']", :visible => false)
+ let(:script_tag_not_rendered) {
+ expect(rendered).not_to have_css("script[src*='#{js_domain}']", visible: false)
}
- let (:noscript_tag_not_rendered) {
- expect(rendered).not_to have_css("noscript iframe[src*='#{js_domain}']", :visible => false)
+ let(:noscript_tag_not_rendered) {
+ expect(rendered).not_to have_css("noscript iframe[src*='#{js_domain}']", visible: false)
}
- let (:session_id_input_not_rendered) {
- expect(rendered).not_to have_css('input[name="doc_auth[threatmetrix_session_id]"]', :visible => false)
+ let(:session_id_input_not_rendered) {
+ expect(rendered).
+ not_to have_css('input[name="doc_auth[threatmetrix_session_id]"]', visible: false)
}
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_account_id).and_return(lexisnexis_threatmetrix_account_id)
+
+ allow(IdentityConfig.store).
+ to receive(:proofing_device_profiling_collecting_enabled).
+ and_return(proofing_device_profiling_collecting_enabled)
+ allow(IdentityConfig.store).
+ to receive(:lexisnexis_threatmetrix_account_id).and_return(lexisnexis_threatmetrix_account_id)
render partial: 'idv/shared/ssn', locals: {
flow_session: {},
@@ -107,7 +114,7 @@
it 'does not render session_id input' do
session_id_input_not_rendered
end
- end
+ end
end
context 'threatmetrix collection disabled' do
From e20904d2aef03bbfe8a89a6f5125bc530abb58f7 Mon Sep 17 00:00:00 2001
From: Alex Bradley
Date: Thu, 4 Aug 2022 14:02:05 -0400
Subject: [PATCH 07/21] moved around logic for checking if TM org_id is
available
---
app/views/idv/shared/_ssn.html.erb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/views/idv/shared/_ssn.html.erb b/app/views/idv/shared/_ssn.html.erb
index f3840689007..af54338abc9 100644
--- a/app/views/idv/shared/_ssn.html.erb
+++ b/app/views/idv/shared/_ssn.html.erb
@@ -28,8 +28,8 @@ locals:
<%= new_window_link_to(t('doc_auth.instructions.learn_more'), MarketingSite.security_and_privacy_practices_url) %>
-<% if IdentityConfig.store.proofing_device_profiling_collecting_enabled && !updating_ssn %>
- <% unless IdentityConfig.store.lexisnexis_threatmetrix_account_id.empty? %>
+<% if IdentityConfig.store.proofing_device_profiling_collecting_enabled %>
+ <% unless IdentityConfig.store.lexisnexis_threatmetrix_account_id.empty? || updating_ssn %>