From eadbf2aeb0789bd90776d3f8b497cb2db6548c52 Mon Sep 17 00:00:00 2001 From: Keith WIlliams Date: Mon, 15 Jul 2024 10:32:13 -0400 Subject: [PATCH 1/5] feat: bypass secondary id check for enhanced ipp --- app/jobs/get_usps_proofing_results_job.rb | 6 ++--- .../get_usps_proofing_results_job_spec.rb | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/jobs/get_usps_proofing_results_job.rb b/app/jobs/get_usps_proofing_results_job.rb index 6ef3868ef16..b31d8ecf32e 100644 --- a/app/jobs/get_usps_proofing_results_job.rb +++ b/app/jobs/get_usps_proofing_results_job.rb @@ -121,8 +121,8 @@ def check_enrollment(enrollment) enrollment.update(status_check_attempted_at: status_check_attempted_at) end - def passed_with_unsupported_secondary_id_type?(response) - return response['secondaryIdType'].present? && + def passed_with_unsupported_secondary_id_type?(enrollment, response) + return !enrollment.enhanced_ipp? && response['secondaryIdType'].present? && SUPPORTED_SECONDARY_ID_TYPES.exclude?(response['secondaryIdType']) end @@ -483,7 +483,7 @@ def process_enrollment_response(enrollment, response) when IPP_STATUS_PASSED if fraud_result_pending?(enrollment) handle_passed_with_fraud_review_pending(enrollment, response) - elsif passed_with_unsupported_secondary_id_type?(response) + elsif passed_with_unsupported_secondary_id_type?(enrollment, response) handle_unsupported_secondary_id(enrollment, response) elsif passed_with_primary_id_check?(enrollment, response) handle_successful_status_update(enrollment, response) diff --git a/spec/jobs/get_usps_proofing_results_job_spec.rb b/spec/jobs/get_usps_proofing_results_job_spec.rb index e3786004737..36b960a8ffc 100644 --- a/spec/jobs/get_usps_proofing_results_job_spec.rb +++ b/spec/jobs/get_usps_proofing_results_job_spec.rb @@ -1561,6 +1561,33 @@ ) end end + + context 'By passes the Secondary ID check when enrollment is Enhanced IPP' do + let!(:pending_enrollment) do + create( + :in_person_enrollment, + :pending, + :with_notification_phone_configuration, + issuer: 'http://localhost:3000', + selected_location_details: { name: 'BALTIMORE' }, + sponsor_id: usps_eipp_sponsor_id, + ) + end + + before do + allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true) + stub_request_passed_proofing_secondary_id_type_results + end + + it_behaves_like( + 'enrollment_with_a_status_update', + passed: true, + email_type: 'Success', + enrollment_status: InPersonEnrollment::STATUS_PASSED, + response_json: UspsInPersonProofing::Mock::Fixtures. + request_passed_proofing_secondary_id_type_results_response, + ) + end end end From 157cca40102a00315f04dc694df52bf2a2eebc3f Mon Sep 17 00:00:00 2001 From: Keith WIlliams Date: Tue, 16 Jul 2024 15:48:52 -0400 Subject: [PATCH 2/5] feat: update tests for reusability --- .../get_usps_proofing_results_job_spec.rb | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/spec/jobs/get_usps_proofing_results_job_spec.rb b/spec/jobs/get_usps_proofing_results_job_spec.rb index 36b960a8ffc..92b481ba85c 100644 --- a/spec/jobs/get_usps_proofing_results_job_spec.rb +++ b/spec/jobs/get_usps_proofing_results_job_spec.rb @@ -1498,24 +1498,28 @@ end describe 'Enhanced In-Person Proofing' do + let!(:pending_enrollment) do + create( + :in_person_enrollment, + :pending, + :with_notification_phone_configuration, + issuer: 'http://localhost:3000', + selected_location_details: { name: 'BALTIMORE' }, + sponsor_id: usps_eipp_sponsor_id, + ) + end + + before do + allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true) + end + context <<~STR.squish do When an Enhanced IPP enrollment passess proofing with unsupported ID,enrollment by-passes the Primary ID check and STR - let!(:pending_enrollment) do - create( - :in_person_enrollment, - :pending, - :with_notification_phone_configuration, - issuer: 'http://localhost:3000', - selected_location_details: { name: 'BALTIMORE' }, - sponsor_id: usps_eipp_sponsor_id, - ) - end before do - allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true) stub_request_passed_proofing_unsupported_id_results end @@ -1563,19 +1567,7 @@ end context 'By passes the Secondary ID check when enrollment is Enhanced IPP' do - let!(:pending_enrollment) do - create( - :in_person_enrollment, - :pending, - :with_notification_phone_configuration, - issuer: 'http://localhost:3000', - selected_location_details: { name: 'BALTIMORE' }, - sponsor_id: usps_eipp_sponsor_id, - ) - end - before do - allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true) stub_request_passed_proofing_secondary_id_type_results end From 49a6f96abcb7f655bc73556793664f5cc5510440 Mon Sep 17 00:00:00 2001 From: Keith WIlliams Date: Tue, 16 Jul 2024 15:51:07 -0400 Subject: [PATCH 3/5] changelog: Upcoming Features, Enhanced In-person proofing, Bypass secondary id check for EIPP From ba0436856c26a1256bd700425815f983b1af5d0a Mon Sep 17 00:00:00 2001 From: Keith WIlliams Date: Mon, 22 Jul 2024 13:19:07 -0400 Subject: [PATCH 4/5] feat: add new IAL2 fixtures --- .../usps_in_person_proofing/mock/fixtures.rb | 6 ++++++ ...g_secondary_id_type_results_response_ial_2.json | 14 ++++++++++++++ spec/jobs/get_usps_proofing_results_job_spec.rb | 4 ++-- spec/support/usps_ipp_helper.rb | 9 +++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 app/services/usps_in_person_proofing/mock/responses/request_passed_proofing_secondary_id_type_results_response_ial_2.json diff --git a/app/services/usps_in_person_proofing/mock/fixtures.rb b/app/services/usps_in_person_proofing/mock/fixtures.rb index c5eaffaa1b7..11a2aac5f62 100644 --- a/app/services/usps_in_person_proofing/mock/fixtures.rb +++ b/app/services/usps_in_person_proofing/mock/fixtures.rb @@ -77,6 +77,12 @@ def self.request_passed_proofing_supported_secondary_id_type_results_response ) end + def self.request_passed_proofing_secondary_id_type_results_response_ial_2 + load_response_fixture( + 'request_passed_proofing_secondary_id_type_results_response_ial_2.json', + ) + end + def self.request_expired_proofing_results_response load_response_fixture('request_expired_proofing_results_response.json') end diff --git a/app/services/usps_in_person_proofing/mock/responses/request_passed_proofing_secondary_id_type_results_response_ial_2.json b/app/services/usps_in_person_proofing/mock/responses/request_passed_proofing_secondary_id_type_results_response_ial_2.json new file mode 100644 index 00000000000..b87e45ab991 --- /dev/null +++ b/app/services/usps_in_person_proofing/mock/responses/request_passed_proofing_secondary_id_type_results_response_ial_2.json @@ -0,0 +1,14 @@ +{ + "status": "In-person passed", + "proofingPostOffice": "WILKES BARRE", + "proofingCity": "WILKES BARRE", + "proofingState": "PA", + "enrollmentCode": "2090002197504352", + "primaryIdType": "State driver's license", + "transactionStartDateTime": "12/17/2020 033855", + "transactionEndDateTime": "12/17/2020 034055", + "secondaryIdType": "State driver's license", + "fraudSuspected": false, + "proofingConfirmationNumber": "350040248346701", + "ippAssuranceLevel": "2.0" +} diff --git a/spec/jobs/get_usps_proofing_results_job_spec.rb b/spec/jobs/get_usps_proofing_results_job_spec.rb index 92b481ba85c..07a12cbfcf1 100644 --- a/spec/jobs/get_usps_proofing_results_job_spec.rb +++ b/spec/jobs/get_usps_proofing_results_job_spec.rb @@ -1568,7 +1568,7 @@ context 'By passes the Secondary ID check when enrollment is Enhanced IPP' do before do - stub_request_passed_proofing_secondary_id_type_results + stub_request_passed_proofing_secondary_id_type_results_ial_2 end it_behaves_like( @@ -1577,7 +1577,7 @@ email_type: 'Success', enrollment_status: InPersonEnrollment::STATUS_PASSED, response_json: UspsInPersonProofing::Mock::Fixtures. - request_passed_proofing_secondary_id_type_results_response, + request_passed_proofing_secondary_id_type_results_response_ial_2, ) end end diff --git a/spec/support/usps_ipp_helper.rb b/spec/support/usps_ipp_helper.rb index a73504ba76d..67b9ab8fff9 100644 --- a/spec/support/usps_ipp_helper.rb +++ b/spec/support/usps_ipp_helper.rb @@ -239,6 +239,15 @@ def stub_request_passed_proofing_supported_secondary_id_type_results ) end + def stub_request_passed_proofing_secondary_id_type_results_ial_2 + stub_request(:post, %r{/ivs-ippaas-api/IPPRest/resources/rest/getProofingResults}).to_return( + status: 200, + body: UspsInPersonProofing::Mock:: + Fixtures.request_passed_proofing_secondary_id_type_results_response_ial_2, + headers: { 'content-type' => 'application/json' }, + ) + end + def stub_request_passed_proofing_unsupported_status_results stub_request(:post, %r{/ivs-ippaas-api/IPPRest/resources/rest/getProofingResults}).to_return( status: 200, From 88a0258e627cde118bed9defa7704d200b98e6f2 Mon Sep 17 00:00:00 2001 From: Keith WIlliams Date: Tue, 23 Jul 2024 10:41:35 -0400 Subject: [PATCH 5/5] feat: add guard clause for eipp under unsupported secondary id check --- app/jobs/get_usps_proofing_results_job.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/get_usps_proofing_results_job.rb b/app/jobs/get_usps_proofing_results_job.rb index b31d8ecf32e..bff4dfe7fd3 100644 --- a/app/jobs/get_usps_proofing_results_job.rb +++ b/app/jobs/get_usps_proofing_results_job.rb @@ -122,8 +122,10 @@ def check_enrollment(enrollment) end def passed_with_unsupported_secondary_id_type?(enrollment, response) - return !enrollment.enhanced_ipp? && response['secondaryIdType'].present? && - SUPPORTED_SECONDARY_ID_TYPES.exclude?(response['secondaryIdType']) + return false if enrollment.enhanced_ipp? + + response['secondaryIdType'].present? && + SUPPORTED_SECONDARY_ID_TYPES.exclude?(response['secondaryIdType']) end def analytics(user: AnonymousUser.new)