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
8 changes: 2 additions & 6 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,15 @@ def shared_update
user_id: current_user.id,
threatmetrix_session_id: idv_session.threatmetrix_session_id,
request_ip: request.remote_ip,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress?,
)

return true
end

private

def double_address_verification
# If in person return true else return false. This is temporary until we add a feature flag
# to track enrollment was created in the in person flow.
# todo LG-11235 update value based on new feature flag
def ipp_enrollment_in_progress?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this name makes sense.

current_user.has_in_person_enrollment?
end

Expand Down Expand Up @@ -222,7 +219,6 @@ def async_state_done(current_async_state)
else
idv_session.invalidate_verify_info_step!
end

analytics.idv_doc_auth_verify_proofing_results(**analytics_arguments, **form_response.to_h)
end

Expand Down
6 changes: 5 additions & 1 deletion app/jobs/resolution_proofing_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def perform(
trace_id:,
should_proof_state_id:,
double_address_verification: false,
ipp_enrollment_in_progress: false,
user_id: nil,
threatmetrix_session_id: nil,
request_ip: nil
Expand All @@ -45,6 +46,7 @@ def perform(
request_ip: request_ip,
should_proof_state_id: should_proof_state_id,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
)

document_capture_session = DocumentCaptureSession.new(result_id: result_id)
Expand All @@ -71,7 +73,8 @@ def make_vendor_proofing_requests(
threatmetrix_session_id:,
request_ip:,
should_proof_state_id:,
double_address_verification:
double_address_verification:,
ipp_enrollment_in_progress:
)
result = resolution_proofer.proof(
applicant_pii: applicant_pii,
Expand All @@ -80,6 +83,7 @@ def make_vendor_proofing_requests(
request_ip: request_ip,
should_proof_state_id: should_proof_state_id,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
timer: timer,
)

Expand Down
4 changes: 2 additions & 2 deletions app/services/idv/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def proof_resolution(
user_id:,
threatmetrix_session_id:,
request_ip:,
double_address_verification: false
ipp_enrollment_in_progress: false
Comment thread
zachmargolis marked this conversation as resolved.
)
document_capture_session.create_proofing_session

Expand All @@ -27,7 +27,7 @@ def proof_resolution(
user_id: user_id,
threatmetrix_session_id: threatmetrix_session_id,
request_ip: request_ip,
double_address_verification: double_address_verification,
double_address_verification: ipp_enrollment_in_progress,
}

if IdentityConfig.store.ruby_workers_idv_enabled
Expand Down
38 changes: 28 additions & 10 deletions app/services/proofing/resolution/progressive_proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ module Resolution
class ProgressiveProofer
# @param [Hash] applicant_pii keys are symbols and values are strings, confidential user info
# @param [Boolean] double_address_verification flag that indicates if user will have
# both state id address and current residential address verified. Note this value is here as
# a placeholder until it can be replaced with ipp_enrollment_in_progress in ticket LG-353:
# https://cm-jira.usa.gov/browse/LG-11353
# @param [Boolean] ipp_enrollment_in_progress flag that indicates if user will have
# both state id address and current residential address verified
# @param [String] request_ip IP address for request
# @param [Boolean] should_proof_state_id based on state id jurisdiction, indicates if
Expand All @@ -18,12 +22,13 @@ class ProgressiveProofer
# @return [ResultAdjudicator] object which contains the logic to determine proofing's result
def proof(
applicant_pii:,
double_address_verification:,
ipp_enrollment_in_progress:,
request_ip:,
should_proof_state_id:,
threatmetrix_session_id:,
timer:,
user_email:
user_email:,
double_address_verification: false
)
device_profiling_result = proof_with_threatmetrix_if_needed(
applicant_pii: applicant_pii,
Expand All @@ -37,10 +42,11 @@ def proof(
applicant_pii: applicant_pii,
timer: timer,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
)

applicant_pii_transformed = applicant_pii.clone
if double_address_verification
if ipp_enrollment_in_progress || double_address_verification
applicant_pii_transformed = with_state_id_address(applicant_pii_transformed)
end

Expand All @@ -49,6 +55,7 @@ def proof(
timer: timer,
residential_instant_verify_result: residential_instant_verify_result,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
)

state_id_result = proof_id_with_aamva_if_needed(
Expand All @@ -58,11 +65,13 @@ def proof(
instant_verify_result: instant_verify_result,
should_proof_state_id: should_proof_state_id,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
)

ResultAdjudicator.new(
device_profiling_result: device_profiling_result,
double_address_verification: double_address_verification,
ipp_enrollment_in_progress: ipp_enrollment_in_progress,
resolution_result: instant_verify_result,
should_proof_state_id: should_proof_state_id,
state_id_result: state_id_result,
Expand Down Expand Up @@ -103,9 +112,11 @@ def proof_with_threatmetrix_if_needed(
def proof_residential_address_if_needed(
applicant_pii:,
timer:,
double_address_verification:
double_address_verification: false,
ipp_enrollment_in_progress: false
)
return residential_address_unnecessary_result unless double_address_verification
return residential_address_unnecessary_result unless
ipp_enrollment_in_progress || double_address_verification

timer.time('residential address') do
resolution_proofer.proof(applicant_pii)
Expand All @@ -126,8 +137,10 @@ def resolution_cannot_pass

def proof_id_address_with_lexis_nexis_if_needed(applicant_pii:, timer:,
residential_instant_verify_result:,
double_address_verification:)
if applicant_pii[:same_address_as_id] == 'true' && double_address_verification == true
double_address_verification:,
ipp_enrollment_in_progress:)
if applicant_pii[:same_address_as_id] == 'true' &&
(ipp_enrollment_in_progress || double_address_verification)
return residential_instant_verify_result
end
return resolution_cannot_pass unless residential_instant_verify_result.success?
Expand All @@ -137,11 +150,14 @@ def proof_id_address_with_lexis_nexis_if_needed(applicant_pii:, timer:,
end
end

def should_proof_state_id_with_aamva?(double_address_verification:, same_address_as_id:,
def should_proof_state_id_with_aamva?(ipp_enrollment_in_progress:, same_address_as_id:,
should_proof_state_id:, instant_verify_result:,
residential_instant_verify_result:)
residential_instant_verify_result:,
double_address_verification:)
return false unless should_proof_state_id
if double_address_verification == false || same_address_as_id == 'true'
# rubocop:disable Layout/LineLength
if (ipp_enrollment_in_progress == false || double_address_verification == false) || same_address_as_id == 'true'
# rubocop:enable Layout/LineLength
user_can_pass_after_state_id_check?(instant_verify_result)
else
residential_instant_verify_result.success?
Expand All @@ -153,11 +169,13 @@ def proof_id_with_aamva_if_needed(
residential_instant_verify_result:,
instant_verify_result:,
should_proof_state_id:,
ipp_enrollment_in_progress:,
double_address_verification:
)
same_address_as_id = applicant_pii[:same_address_as_id]
should_proof_state_id_with_aamva = should_proof_state_id_with_aamva?(
double_address_verification:,
ipp_enrollment_in_progress:,
same_address_as_id:,
should_proof_state_id:,
instant_verify_result:,
Expand Down
14 changes: 8 additions & 6 deletions app/services/proofing/resolution/result_adjudicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ module Proofing
module Resolution
class ResultAdjudicator
attr_reader :resolution_result, :state_id_result, :device_profiling_result,
:double_address_verification, :residential_resolution_result, :same_address_as_id
:double_address_verification, :ipp_enrollment_in_progress,
:residential_resolution_result, :same_address_as_id

def initialize(
resolution_result:, # InstantVerify
state_id_result:, # AAMVA
residential_resolution_result:, # InstantVerify Residential
should_proof_state_id:,
double_address_verification:,
ipp_enrollment_in_progress:,
device_profiling_result:,
same_address_as_id:
same_address_as_id:,
double_address_verification: false
)
@resolution_result = resolution_result
@state_id_result = state_id_result
@should_proof_state_id = should_proof_state_id
@ipp_enrollment_in_progress = ipp_enrollment_in_progress
@double_address_verification = double_address_verification
@device_profiling_result = device_profiling_result
@residential_resolution_result = residential_resolution_result
Expand All @@ -37,7 +40,6 @@ def adjudicated_result
device_profiling_adjudication_reason: device_profiling_reason,
resolution_adjudication_reason: resolution_reason,
should_proof_state_id: should_proof_state_id?,
double_address_verification: double_address_verification,
Comment thread
gina-yamada marked this conversation as resolved.
stages: {
resolution: resolution_result.to_h,
residential_address: residential_resolution_result.to_h,
Expand Down Expand Up @@ -87,8 +89,8 @@ def device_profiling_result_and_reason
end

def resolution_result_and_reason
if !residential_resolution_result.success? &&
same_address_as_id == 'false' && double_address_verification == true
if !residential_resolution_result.success? && same_address_as_id == 'false' &&
(ipp_enrollment_in_progress || double_address_verification)
[false, :fail_resolution_skip_state_id]
elsif resolution_result.success? && state_id_result.success?
[true, :pass_resolution_and_state_id]
Expand Down
10 changes: 5 additions & 5 deletions spec/controllers/idv/in_person/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
allow(user).to receive(:establishing_in_person_enrollment).and_return(nil)
end

it 'disables double address verification for the user' do
it 'indicates to the IDV agent that an IPP enrollment is not in progress' do
expect_any_instance_of(Idv::Agent).to receive(:proof_resolution).
with(
kind_of(DocumentCaptureSession),
Expand All @@ -160,23 +160,23 @@
threatmetrix_session_id: nil,
user_id: anything,
request_ip: request.remote_ip,
double_address_verification: false,
ipp_enrollment_in_progress: false,
)

put :update
end
end

context 'a user does have an establishing in person enrollment associated with them' do
it 'indicates to the IDV agent that double_address_verification is enabled' do
it 'indicates to the IDV agent that ipp_enrollment_in_progress is enabled' do
expect_any_instance_of(Idv::Agent).to receive(:proof_resolution).with(
kind_of(DocumentCaptureSession),
should_proof_state_id: anything,
trace_id: anything,
threatmetrix_session_id: anything,
user_id: anything,
request_ip: anything,
double_address_verification: true,
ipp_enrollment_in_progress: true,
)

put :update
Expand All @@ -199,7 +199,7 @@
threatmetrix_session_id: nil,
user_id: anything,
request_ip: request.remote_ip,
double_address_verification: true,
ipp_enrollment_in_progress: true,
)

put :update
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
verified_attributes: [],
),
device_profiling_result: Proofing::DdpResult.new(success: true),
double_address_verification: false,
ipp_enrollment_in_progress: false,
residential_resolution_result: Proofing::Resolution::Result.new(success: true),
resolution_result: Proofing::Resolution::Result.new(success: true),
same_address_as_id: true,
Expand Down
Loading