Skip to content

Commit

Permalink
LG-15168 | Proofing components now only takes idv_session (#11771)
Browse files Browse the repository at this point in the history
changelog: Internal, IDV, Update ProofingComponents to only take an idv_session
  • Loading branch information
n1zyy authored Feb 4, 2025
1 parent f81d99e commit d5cf8e0
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 127 deletions.
7 changes: 1 addition & 6 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ def shared_update
threatmetrix_session_id: idv_session.threatmetrix_session_id,
request_ip: request.remote_ip,
ipp_enrollment_in_progress: ipp_enrollment_in_progress?,
proofing_components: ProofingComponents.new(
user: current_user,
idv_session:,
session:,
user_session:,
),
proofing_components: ProofingComponents.new(idv_session:),
)

return true
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/idv/enter_password_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@ def init_profile
profile = idv_session.create_profile_from_applicant_with_password(
password,
is_enhanced_ipp: resolved_authn_context_result.enhanced_ipp?,
proofing_components: ProofingComponents.new(
user: current_user,
idv_session:,
session:,
user_session:,
).to_h,
proofing_components: ProofingComponents.new(idv_session:).to_h,
)

if profile.gpo_verification_pending?
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/idv/in_person/state_id_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def update
pii_from_user[attr] = flow_params[attr]
end

analytics.idv_in_person_proofing_state_id_submitted(
**analytics_arguments.merge(**form_result),
)
# Accept Date of Birth from both memorable date and input date components
formatted_dob = MemorableDateComponent.extract_date_param flow_params&.[](:dob)
pii_from_user[:dob] = formatted_dob if formatted_dob
Expand All @@ -57,6 +54,11 @@ def update
end

idv_session.doc_auth_vendor = Idp::Constants::Vendors::USPS

analytics.idv_in_person_proofing_state_id_submitted(
**analytics_arguments.merge(**form_result),
)

redirect_to redirect_url
else
render :show, locals: extra_view_variables
Expand Down
7 changes: 1 addition & 6 deletions app/services/idv/analytics_events_enhancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,7 @@ def proofing_components
service_provider: sp,
)

proofing_components_hash = ProofingComponents.new(
idv_session:,
session:,
user:,
user_session:,
).to_h
proofing_components_hash = ProofingComponents.new(idv_session:).to_h

proofing_components_hash.empty? ? nil : proofing_components_hash
end
Expand Down
19 changes: 3 additions & 16 deletions app/services/idv/proofing_components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@

module Idv
class ProofingComponents
def initialize(idv_session:, session:, user:, user_session:)
def initialize(idv_session:)
@idv_session = idv_session
@session = session
@user = user
@user_session = user_session
end

def document_check
if user.establishing_in_person_enrollment || user.pending_in_person_enrollment
Idp::Constants::Vendors::USPS
elsif idv_session.remote_document_capture_complete?
DocAuthRouter.doc_auth_vendor(
request: nil,
service_provider: idv_session.service_provider,
session:,
user_session:,
user:,
)
end
idv_session.doc_auth_vendor
end

def document_type
Expand Down Expand Up @@ -73,6 +60,6 @@ def to_h

private

attr_reader :idv_session, :session, :user, :user_session
attr_reader :idv_session
end
end
2 changes: 1 addition & 1 deletion spec/controllers/idv/cancellations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@

context 'with in establishing in-person enrollment' do
let(:user) { build(:user, :with_establishing_in_person_enrollment) }
let(:enrollment) { user.establishing_in_person_enrollment }
let!(:enrollment) { user.establishing_in_person_enrollment }

before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
Expand Down
34 changes: 0 additions & 34 deletions spec/controllers/idv/in_person/usps_locations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,6 @@
)
expect(enrollment.service_provider).to eq(sp)
end

it 'updates proofing component vendor' do
proofing_components = Idv::ProofingComponents.new(
idv_session: controller.idv_session,
session: controller.session,
user_session: controller.user_session,
user:,
)

expect(proofing_components.document_check).to be_nil

response

user.reload

expect(proofing_components.document_check).to eq Idp::Constants::Vendors::USPS
end
end

context 'when the user is going through EIPP' do
Expand All @@ -411,23 +394,6 @@
)
expect(enrollment.service_provider).to eq(sp)
end

it 'updates proofing component vendor' do
proofing_components = Idv::ProofingComponents.new(
idv_session: controller.idv_session,
session: controller.session,
user_session: controller.user_session,
user:,
)

expect(proofing_components.document_check).to be_nil

response

user.reload

expect(proofing_components.document_check).to eq Idp::Constants::Vendors::USPS
end
end

context 'when unauthenticated' do
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/idv/link_sent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@

proofing_components = Idv::ProofingComponents.new(
idv_session: subject.idv_session,
session: subject.session,
user_session: subject.user_session,
user:,
)
expect(proofing_components.document_check).to eq('mock')
expect(proofing_components.document_type).to eq('state_id')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
flow_path: 'standard', opted_in_to_in_person_proofing: false
},
'IdV: in person proofing state_id visited' => {
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing', proofing_components: { document_check: 'usps' }
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing'
},
'IdV: in person proofing state_id submitted' => {
success: true, flow_path: 'standard', step: 'state_id', analytics_id: 'In Person Proofing', birth_year: '1938', document_zip_code: '12345', proofing_components: { document_check: 'usps' }
Expand Down
8 changes: 1 addition & 7 deletions spec/services/idv/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@
end
end
let(:proofing_components) do
Idv::ProofingComponents.new(
idv_session:,
session:,
user:,
user_session:,
)
Idv::ProofingComponents.new(idv_session:)
end

subject(:agent) { Idv::Agent.new(applicant) }
Expand Down Expand Up @@ -147,7 +142,6 @@
expect(ResolutionProofingJob).to receive(:perform_later).with(
hash_including(
proofing_components: {
document_check: 'mock',
document_type: 'state_id',
},
),
Expand Down
1 change: 0 additions & 1 deletion spec/services/idv/analytics_events_enhancer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def track_event(_event, **kwargs)
expect(analytics.called_kwargs).to eql(
extra: true,
proofing_components: {
document_check: 'mock',
document_type: 'state_id',
},
)
Expand Down
48 changes: 5 additions & 43 deletions spec/services/idv/proofing_components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

subject do
described_class.new(
session:,
user:,
user_session:,
idv_session:,
)
end
Expand All @@ -40,12 +37,13 @@
idv_session.threatmetrix_review_status = 'pass'
idv_session.source_check_vendor = 'aamva'
idv_session.resolution_vendor = 'lexis_nexis'
idv_session.doc_auth_vendor = 'feedabee'
end

it 'returns expected result' do
expect(subject.to_h).to eql(
{
document_check: 'test_vendor',
document_check: 'feedabee',
document_type: 'state_id',
source_check: 'aamva',
resolution_check: 'lexis_nexis',
Expand All @@ -58,46 +56,10 @@
end

describe '#document_check' do
it 'returns nil by default' do
expect(subject.document_check).to be_nil
end

context 'in-person proofing' do
context 'establishing' do
let!(:enrollment) { create(:in_person_enrollment, :establishing, user:) }

it 'returns USPS' do
expect(subject.document_check).to eql(Idp::Constants::Vendors::USPS)
end
end

context 'pending' do
let!(:enrollment) { create(:in_person_enrollment, :pending, user:) }

it 'returns USPS' do
expect(subject.document_check).to eql(Idp::Constants::Vendors::USPS)
end
end
end

context 'doc auth' do
before do
allow(IdentityConfig.store).to receive(:doc_auth_vendor_default).and_return('test_vendor')
end

context 'before doc auth complete' do
it 'returns nil' do
expect(subject.document_check).to be_nil
end
end

context 'after doc auth completed successfully' do
let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT }
before { idv_session.doc_auth_vendor = 'feedabee' }

it 'returns doc auth vendor' do
expect(subject.document_check).to eql('test_vendor')
end
end
it 'returns doc_auth_vendor' do
expect(subject.document_check).to eql('feedabee')
end
end

Expand Down

0 comments on commit d5cf8e0

Please sign in to comment.