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
13 changes: 8 additions & 5 deletions app/jobs/resolution_proofing_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def perform(
should_proof_state_id:,
ipp_enrollment_in_progress:,
user_id: nil,
service_provider_issuer: nil, # rubocop:disable Lint/UnusedMethodArgument
service_provider_issuer: nil,
threatmetrix_session_id: nil,
request_ip: nil,
instant_verify_ab_test_discriminator: nil # rubocop:disable Lint/UnusedMethodArgument
Expand All @@ -37,9 +37,12 @@ def perform(
symbolize_names: true,
)

applicant_pii = decrypted_args[:applicant_pii]

user = User.find_by(id: user_id)
current_sp = ServiceProvider.find_by(issuer: service_provider_issuer)

applicant_pii = decrypted_args[:applicant_pii]
applicant_pii[:uuid_prefix] = current_sp&.app_id
applicant_pii[:uuid] = user.uuid

callback_log_data = make_vendor_proofing_requests(
timer: timer,
Expand Down Expand Up @@ -79,7 +82,7 @@ def make_vendor_proofing_requests(
)
result = resolution_proofer.proof(
applicant_pii: applicant_pii,
user_email: user&.confirmed_email_addresses&.first&.email,
user_email: user.confirmed_email_addresses.first.email,
threatmetrix_session_id: threatmetrix_session_id,
request_ip: request_ip,
should_proof_state_id: should_proof_state_id,
Expand All @@ -102,7 +105,7 @@ def make_vendor_proofing_requests(
def log_threatmetrix_info(threatmetrix_result, user)
logger_info_hash(
name: 'ThreatMetrix',
user_id: user&.uuid,
user_id: user.uuid,
threatmetrix_request_id: threatmetrix_result.transaction_id,
threatmetrix_success: threatmetrix_result.success?,
)
Expand Down
20 changes: 20 additions & 0 deletions spec/jobs/resolution_proofing_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
let(:should_proof_state_id) { true }
let(:trace_id) { SecureRandom.uuid }
let(:user) { create(:user, :fully_registered) }
let(:service_provider) { create(:service_provider, app_id: 'fake-app-id') }
let(:request_ip) { Faker::Internet.ip_v4_address }
let(:threatmetrix_session_id) { SecureRandom.uuid }
let(:proofing_device_profiling) { :enabled }
Expand All @@ -38,6 +39,7 @@
encrypted_arguments: encrypted_arguments,
trace_id: trace_id,
user_id: user.id,
service_provider_issuer: service_provider.issuer,
threatmetrix_session_id: threatmetrix_session_id,
request_ip: request_ip,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
Expand Down Expand Up @@ -498,6 +500,24 @@
end
end

it 'determines the UUID and UUID prefix and passes it to the downstream proofing vendors' do
uuid_info = {
uuid_prefix: service_provider.app_id,
uuid: user.uuid,
}

stub_vendor_requests

expect_any_instance_of(Proofing::LexisNexis::InstantVerify::Proofer).to receive(:proof).
with(hash_including(uuid_info)).and_call_original

expect_any_instance_of(Proofing::Aamva::Proofer).to receive(:proof).with(
hash_including(uuid_info),
).and_call_original

perform
end

def stub_vendor_requests(
instant_verify_response: LexisNexisFixtures.instant_verify_success_response_json,
threatmetrix_response: LexisNexisFixtures.ddp_success_response_json,
Expand Down
2 changes: 1 addition & 1 deletion spec/services/idv/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'ostruct'

RSpec.describe Idv::Agent do
let(:user) { build(:user) }
let(:user) { create(:user) }

let(:bad_phone) do
Proofing::Mock::AddressMockClient::UNVERIFIABLE_PHONE_NUMBER
Expand Down