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
3 changes: 3 additions & 0 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def async_state_done(current_async_state)
[:proofing_results, :context, :stages, :threatmetrix, :response_body, :first_name],
[:same_address_as_id],
[:proofing_results, :context, :stages, :state_id, :state_id_jurisdiction],
[:proofing_results, :biographical_info, :identity_doc_address_state],
[:proofing_results, :biographical_info, :state_id_jurisdiction],
[:proofing_results, :biographical_info, :same_address_as_id],
],
},
)
Expand Down
4 changes: 4 additions & 0 deletions app/jobs/socure_shadow_mode_proofing_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def perform(
[:resolution_result, :context, :stages, :residential_address, :errors, :ssn],
[:resolution_result, :context, :stages, :threatmetrix, :response_body, :first_name],
[:resolution_result, :context, :stages, :state_id, :state_id_jurisdiction],
[:resolution_result, :context, :stages, :state_id, :state_id_jurisdiction],
[:resolution_result, :biographical_info, :identity_doc_address_state],
[:resolution_result, :biographical_info, :state_id_jurisdiction],
[:resolution_result, :biographical_info, :same_address_as_id],
],
)
end
Expand Down
1 change: 1 addition & 0 deletions app/services/proofing/resolution/progressive_proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def proof(
state_id_result: state_id_result,
residential_resolution_result: residential_instant_verify_result,
same_address_as_id: applicant_pii[:same_address_as_id],
applicant_pii: applicant_pii,
)
end

Expand Down
23 changes: 21 additions & 2 deletions app/services/proofing/resolution/result_adjudicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module Proofing
module Resolution
class ResultAdjudicator
attr_reader :resolution_result, :state_id_result, :device_profiling_result,
:ipp_enrollment_in_progress, :residential_resolution_result, :same_address_as_id
:ipp_enrollment_in_progress, :residential_resolution_result, :same_address_as_id,
:applicant_pii

def initialize(
resolution_result:, # InstantVerify
Expand All @@ -13,7 +14,8 @@ def initialize(
should_proof_state_id:,
ipp_enrollment_in_progress:,
device_profiling_result:,
same_address_as_id:
same_address_as_id:,
applicant_pii:
)
@resolution_result = resolution_result
@state_id_result = state_id_result
Expand All @@ -22,6 +24,7 @@ def initialize(
@device_profiling_result = device_profiling_result
@residential_resolution_result = residential_resolution_result
@same_address_as_id = same_address_as_id # this is a string, "true" or "false"
@applicant_pii = applicant_pii
end

def adjudicated_result
Expand All @@ -46,6 +49,7 @@ def adjudicated_result
threatmetrix: device_profiling_result.to_h,
},
},
biographical_info: biographical_info,
},
)
end
Expand Down Expand Up @@ -112,6 +116,21 @@ def state_id_attributes_cover_resolution_failures?

(failed_resolution_attributes.to_a - passed_state_id_attributes.to_a).empty?
end

def biographical_info
state_id_number = applicant_pii[:state_id_number]
redacted_state_id_number = if state_id_number.present?
StringRedacter.redact_alphanumeric(state_id_number)
end
{
birth_year: applicant_pii[:dob]&.to_date&.year,
state: applicant_pii[:state],
identity_doc_address_state: applicant_pii[:identity_doc_address_state],
state_id_jurisdiction: applicant_pii[:state_id_jurisdiction],
state_id_number: redacted_state_id_number,
same_address_as_id: applicant_pii[:same_address_as_id],
}
end
end
end
end
1 change: 1 addition & 0 deletions spec/controllers/idv/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
resolution_result: Proofing::Resolution::Result.new(success: true),
same_address_as_id: true,
should_proof_state_id: true,
applicant_pii: Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN,
).adjudicated_result.to_h

document_capture_session.create_proofing_session
Expand Down
16 changes: 16 additions & 0 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@
threatmetrix: threatmetrix_response,
},
},
biographical_info: {
birth_year: 1938,
identity_doc_address_state: nil,
same_address_as_id: nil,
state: 'MT',
state_id_jurisdiction: 'ND',
state_id_number: '#############',
},
}
end

Expand Down Expand Up @@ -137,6 +145,14 @@
threatmetrix: threatmetrix_response,
},
},
biographical_info: {
birth_year: 1938,
identity_doc_address_state: 'ND',
same_address_as_id: 'false',
state: 'MT',
state_id_jurisdiction: 'ND',
state_id_number: '#############',
},
}
end

Expand Down
16 changes: 16 additions & 0 deletions spec/jobs/socure_shadow_mode_proofing_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@
},
},
},
biographical_info: {
birth_year: 1938,
identity_doc_address_state: nil,
same_address_as_id: nil,
state: 'MT',
state_id_jurisdiction: 'ND',
state_id_number: '#############',
},
ssn_is_unique: true,
},
)
Expand Down Expand Up @@ -250,6 +258,14 @@
ssn_is_unique: true,
threatmetrix_review_status: 'pass',
timed_out: false,
biographical_info: {
birth_year: 1938,
identity_doc_address_state: nil,
same_address_as_id: nil,
state: 'MT',
state_id_jurisdiction: 'ND',
state_id_number: '#############',
},
},
socure_result: {
attributes_requiring_additional_verification: [],
Expand Down
37 changes: 37 additions & 0 deletions spec/services/proofing/resolution/result_adjudicator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
)
end

let(:applicant_pii) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN }

subject do
described_class.new(
resolution_result: resolution_result,
Expand All @@ -53,6 +55,7 @@
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
device_profiling_result: device_profiling_result,
same_address_as_id: same_address_as_id,
applicant_pii: applicant_pii,
)
end

Expand Down Expand Up @@ -92,5 +95,39 @@
end
end
end

describe 'biographical_info' do
context 'the applicant PII contains one address' do
it 'includes formatted PII' do
result = subject.adjudicated_result

expect(result.extra[:biographical_info]).to eq(
birth_year: 1938,
state: 'MT',
identity_doc_address_state: nil,
state_id_jurisdiction: 'ND',
state_id_number: '#############',
same_address_as_id: nil,
)
end
end

context 'the applicant PII contains a residential address and document address' do
let(:applicant_pii) { Idp::Constants::MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID }

it 'includes formatted PII' do
result = subject.adjudicated_result

expect(result.extra[:biographical_info]).to eq(
birth_year: 1938,
state: 'MT',
identity_doc_address_state: 'MT',
state_id_jurisdiction: 'ND',
state_id_number: '#############',
same_address_as_id: 'true',
)
end
end
end
end
end