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
10 changes: 6 additions & 4 deletions app/jobs/get_usps_proofing_results_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
eileen-nava marked this conversation as resolved.
Outdated
return false if enrollment.enhanced_ipp?

response['secondaryIdType'].present? &&
SUPPORTED_SECONDARY_ID_TYPES.exclude?(response['secondaryIdType'])
end

def analytics(user: AnonymousUser.new)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions app/services/usps_in_person_proofing/mock/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
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.

👏🏻 for the updated ippAssuranceLevel

}
41 changes: 30 additions & 11 deletions spec/jobs/get_usps_proofing_results_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1498,24 +1498,28 @@
end
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'm commenting on a file so that we can thread responses to this comment and resolve the conversation when we're done chatting.)

I noticed that the testing plan recommends using UspsInPersonProofing::Mock::Fixtures.request_passed_proofing_secondary_id_type_results_response. When I look at this mock file, it has "ippAssuranceLevel": "1.5". Since this is EIPP, I think we'd want to use a file with "ippAssuranceLevel": "2.0".

I don't know that this would affect behavior for the testing plan, but I wanted to flag it because that line jumped out at me.

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 would recommend using fixtures that have the correct assurance level in the specs. Thoughts?


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

Expand Down Expand Up @@ -1561,6 +1565,21 @@
)
end
end

context 'By passes the Secondary ID check when enrollment is Enhanced IPP' do
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.

Non-blocking nit: I think Bypasses should be one word here

before do
stub_request_passed_proofing_secondary_id_type_results_ial_2
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.

👏🏻

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

Expand Down
9 changes: 9 additions & 0 deletions spec/support/usps_ipp_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down