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
1 change: 1 addition & 0 deletions app/controllers/concerns/mfa_setup_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def threatmetrix_attrs
threatmetrix_session_id: user_session[:sign_up_threatmetrix_session_id],
email: current_user.last_sign_in_email_address.email,
uuid_prefix: current_sp&.app_id,
user_uuid: current_user.uuid,
}
end

Expand Down
3 changes: 1 addition & 2 deletions app/jobs/account_creation_threat_metrix_job.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

class AccountCreationThreatMetrixJob < ApplicationJob
# rubocop:disable Lint/UnusedMethodArgument
def perform(
user_id: nil,
threatmetrix_session_id: nil,
Expand All @@ -15,12 +14,12 @@ def perform(
threatmetrix_session_id: threatmetrix_session_id,
user_email: email,
uuid_prefix: uuid_prefix,
uuid: user_uuid,
)
ensure
user = User.find_by(id: user_id)
analytics(user).account_creation_tmx_result(**device_profiling_result.to_h)
end
# rubocop:enable Lint/UnusedMethodArgument

def analytics(user)
Analytics.new(user: user, request: nil, session: {}, sp: nil)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/resolution_proofing_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def make_vendor_proofing_requests(
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
timer: timer,
current_sp: current_sp,
user_uuid: user.uuid,
)

log_threatmetrix_info(result.device_profiling_result, user)
Expand Down
8 changes: 6 additions & 2 deletions app/services/account_creation/device_profiling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ class DeviceProfiling
:threatmetrix_session_id,
:user_email,
:device_profile_result,
:uuid_prefix
:uuid_prefix,
:uuid
def proof(
request_ip:,
threatmetrix_session_id:,
user_email:,
uuid_prefix:
uuid_prefix:,
uuid:
)
@request_ip = request_ip
@threatmetrix_session_id = threatmetrix_session_id
@user_email = user_email
@uuid_prefix = uuid_prefix
@uuid = uuid

@device_profile_result = device_profile
end
Expand All @@ -31,6 +34,7 @@ def device_profile
email: user_email,
request_ip: request_ip,
uuid_prefix: uuid_prefix,
uuid: uuid,
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def build_request_body
national_id_type: applicant[:ssn] ? 'US_SSN' : '',
input_ip_address: applicant[:request_ip],
local_attrib_1: applicant[:uuid_prefix] || '',
local_attrib_3: applicant[:uuid],
Comment thread
mdiarra3 marked this conversation as resolved.
}.to_json
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def call(
request_ip:,
threatmetrix_session_id:,
timer:,
user_email:
user_email:,
user_uuid:
)
unless FeatureManagement.proofing_device_profiling_collecting_enabled?
return threatmetrix_disabled_result
Expand All @@ -25,6 +26,7 @@ def call(
threatmetrix_session_id: threatmetrix_session_id,
email: user_email,
request_ip: request_ip,
uuid: user_uuid,
)

timer.time('threatmetrix') do
Expand Down
5 changes: 4 additions & 1 deletion app/services/proofing/resolution/progressive_proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def initialize
# @param [String] threatmetrix_session_id identifies the threatmetrix session
# @param [JobHelpers::Timer] timer indicates time elapsed to obtain results
# @param [String] user_email email address for applicant
# @param [String] user_uuid user uuid for applicant
# @return [ResultAdjudicator] object which contains the logic to determine proofing's result
def proof(
applicant_pii:,
Expand All @@ -39,7 +40,8 @@ def proof(
timer:,
user_email:,
ipp_enrollment_in_progress:,
current_sp:
current_sp:,
user_uuid:
)
applicant_pii = applicant_pii.except(:best_effort_phone_number_for_socure)

Expand All @@ -50,6 +52,7 @@ def proof(
request_ip:,
timer:,
user_email:,
user_uuid:,
)

residential_address_resolution_result = residential_address_plugin.call(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"account_drivers_license_type": "",
"national_id_number": "",
"national_id_type": "",
"local_attrib_1": ""
"local_attrib_1": "",
"local_attrib_3": "00000000-0000-0000-0000-000000000000"
}

3 changes: 2 additions & 1 deletion spec/fixtures/proofing/lexis_nexis/ddp/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"national_id_number": "123456789",
"national_id_type": "US_SSN",
"input_ip_address": "127.0.0.1",
"local_attrib_1": "ABCD"
"local_attrib_1": "ABCD",
"local_attrib_3": "00000000-0000-0000-0000-000000000000"

}
2 changes: 1 addition & 1 deletion spec/jobs/account_creation_threat_metrix_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
threatmetrix_session_id: threatmetrix_session_id,
request_ip: request_ip,
uuid_prefix: service_provider.app_id,
user_uuid: '00000000-0000-0000-0000-000000000000',
user_uuid: user.uuid,
)
end

Expand Down
4 changes: 3 additions & 1 deletion spec/services/account_creation/device_profiling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
proof: threatmetrix_proofer_result,
)
end
let(:user) { create(:user) }

subject(:device_profiling) { described_class.new }

Expand All @@ -24,8 +25,9 @@
device_profiling.proof(
request_ip: Faker::Internet.ip_v4_address,
threatmetrix_session_id: threatmetrix_session_id,
user_email: Faker::Internet.email,
user_email: user.email_addresses.take.email,
uuid_prefix: service_provider.app_id,
uuid: user.uuid,
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
email: 'test@example.com',
request_ip: '127.0.0.1',
uuid_prefix: 'ABCD',
uuid: '00000000-0000-0000-0000-000000000000',
}
end

Expand Down Expand Up @@ -66,6 +67,7 @@
threatmetrix_session_id: 'UNIQUE_SESSION_ID',
email: 'test@example.com',
request_ip: '127.0.0.1',
uuid: '00000000-0000-0000-0000-000000000000',
}
end

Expand All @@ -89,6 +91,7 @@
email: 'test@example.com',
request_ip: '127.0.0.1',
uuid_prefix: 'SPNUM',
uuid: '00000000-0000-0000-0000-000000000000',
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
let(:request_ip) { Faker::Internet.ip_v4_address }
let(:threatmetrix_session_id) { 'cool-session-id' }
let(:user_email) { Faker::Internet.email }
let(:user_uuid) { '00000000-0000-0000-0000-000000000000' }

subject(:plugin) do
described_class.new
Expand All @@ -33,6 +34,7 @@ def sp_cost_count
threatmetrix_session_id:,
timer: JobHelpers::Timer.new,
user_email:,
user_uuid:,
)
end

Expand All @@ -49,6 +51,7 @@ def sp_cost_count
threatmetrix_session_id: threatmetrix_session_id,
email: user_email,
request_ip: request_ip,
uuid: user_uuid,
)
end

Expand Down
5 changes: 5 additions & 0 deletions spec/services/proofing/resolution/progressive_proofer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
let(:threatmetrix_session_id) { SecureRandom.uuid }
let(:user_email) { Faker::Internet.email }
let(:current_sp) { build(:service_provider) }
let(:user_uuid) { '00000000-0000-0000-0000-000000000000' }

let(:residential_address_resolution_result) do
Proofing::Resolution::Result.new(
Expand Down Expand Up @@ -81,6 +82,7 @@
timer: JobHelpers::Timer.new,
user_email:,
current_sp:,
user_uuid:,
)
end

Expand Down Expand Up @@ -145,6 +147,7 @@
threatmetrix_session_id:,
timer: an_instance_of(JobHelpers::Timer),
user_email:,
user_uuid:,
)
proof
end
Expand Down Expand Up @@ -217,6 +220,7 @@
threatmetrix_session_id:,
timer: an_instance_of(JobHelpers::Timer),
user_email:,
user_uuid:,
)
proof
end
Expand Down Expand Up @@ -248,6 +252,7 @@
threatmetrix_session_id:,
timer: an_instance_of(JobHelpers::Timer),
user_email:,
user_uuid:,
)
proof
end
Expand Down