diff --git a/app/jobs/get_usps_proofing_results_job.rb b/app/jobs/get_usps_proofing_results_job.rb index 6ef3868ef16..bff4dfe7fd3 100644 --- a/app/jobs/get_usps_proofing_results_job.rb +++ b/app/jobs/get_usps_proofing_results_job.rb @@ -121,9 +121,11 @@ 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? && - SUPPORTED_SECONDARY_ID_TYPES.exclude?(response['secondaryIdType']) + def passed_with_unsupported_secondary_id_type?(enrollment, response) + return false if enrollment.enhanced_ipp? + + response['secondaryIdType'].present? && + SUPPORTED_SECONDARY_ID_TYPES.exclude?(response['secondaryIdType']) end def analytics(user: AnonymousUser.new) @@ -483,7 +485,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/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 e3786004737..07a12cbfcf1 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 @@ -1561,6 +1565,21 @@ ) end end + + context 'By passes the Secondary ID check when enrollment is Enhanced IPP' do + before do + stub_request_passed_proofing_secondary_id_type_results_ial_2 + 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_ial_2, + ) + end 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,