LG-14317 Fix Cancelled and Failed enrollments put users in broken account state#11149
LG-14317 Fix Cancelled and Failed enrollments put users in broken account state#11149gina-yamada merged 12 commits intomainfrom
Conversation
…rification_pending_at timestamp to nil when the enrollment gets cancelled in the get_usps_proofing_results_job
eileen-nava
left a comment
There was a problem hiding this comment.
It feels weird to me to use a method named deactivate_due_to_ipp_expiration in scenarios where the in_person_enrollment didn't actually expire. Maybe we could rename deactivate_due_to_ipp_expiration to something more general, like deactivate_during_ipp?
I am slightly concerned that down the road, developers who are new to the project might confuse deactivate_during_ipp and deactivate_for_in_person_verification. The methods have opposite effects on the in_person_verification_pending_at profile timestamp, but similar names. The acronym and full name discrepancy is also not great.
Please let me know if you can think of a clearer name than deactivate_due_to_ipp!
| enrollment_records = InPersonEnrollment.where(id: pending_enrollments.map(&:id)) | ||
| # Below sets in_person_verification_pending_at | ||
| # on the profile associated with each pending enrollment | ||
| enrollment_records.each do |enrollment| |
There was a problem hiding this comment.
Is it possible to update the :in_person_enrollment :pending factory trait and set the profile in_person_verification_pending_at timestamp in there, maybe similar to what Andrew did here in the users factory?
I know we have a ticket to clean up the in_person_enrollments factory and am okay with also doing the suggested work while working on that ticket.
There was a problem hiding this comment.
I added this to the in_person_enrollment factory. see commit
jennyverdeyen
left a comment
There was a problem hiding this comment.
I ran through each testing scenario - I think there was a small error in Scenario 1 (unsupported ID type) where you meant to specify request_passed_proofing_unsupported_id_results_response as the mock fixture to use. With that assumption, I ran all the scenarios and everything behaved as expected. The broken account state doesn't occur.
Tests pass!
I like the improved method name for deactivate_due_to_in_person_verification_cancelled!
Great work, LGTM!
@eileen-nava Are you okay with the new name |
…r_account_page_and_usps_job
…:18F/identity-idp into yamada/fix_for_account_page_and_usps_job
@gina-yamada Yes, I am okay with the new name I think we can merge this PR now. Great work! |
🎫 Ticket
LG-14317 Cancelled and Failed enrollments put users in broken account state
🛠 Summary of changes
📜 Testing Plan
Scenario 1: Unsupported ID Type
Create an enrollment- get to Ready to Verify (barcode page)
In your terminal open the rails console
Verify that the enrollment is updated to status is failed.
eVerify that the profile associated with the enrollment is not active (active = false), in_person_verification_pending_at is nil, and the deactivation_reason is verification_cancelled.
e.profileRefresh from the Ready to Verify View (Barcode code page). Confirm you are taken to the account view.
Sign out.
Sign-in via Login.gov (Verify application navigates to the account page). Sign out.
Sign-in via Sinatra (Verify application navigates to the verification welcome page ie: /verify/welcome)
Step through IPP to successfully create a barcode
Scenario 2: Handle Unexpected Response
Create an enrollment- get to Ready to Verify (barcode page)
Make temporarily updates to app/services/usps_in_person_proofing/mock/proofer.rb commenting out the original request_proofing_results method to the following:
In your terminal open the rails console
e = InPersonEnrollment.lastCopy the enrollment code.
Update the enrollment code in
app/services/usps_in_person_proofing/mock/responses/request_unexpected_invalid_enrollment_code_response.json
Verify that the enrollment is updated to status is cancelled.
eVerify that the profile associated with the enrollment is not active (active = false), in_person_verification_pending_at is nil, and the deactivation_reason is verification_cancelled.
e.profileRefresh from the Ready to Verify View (Barcode code page). Confirm you are taken to the account view.
Sign out.
Sign-in via Login.gov (Verify application navigates to the account page). Sign out.
Sign-in via Sinatra (Verify application navigates to the verification welcome page ie: /verify/welcome)
Step through IPP to successfully create a barcode
After, be sure to change code back in...
Scenario 3: Handle Failed Status
Create an enrollment- get to Ready to Verify (barcode page)
In your terminal open the rails console
Verify that the enrollment is updated to status is failed.
eVerify that the profile associated with the enrollment is not active (active = false), in_person_verification_pending_at is nil, and the deactivation_reason is verification_cancelled.
e.profileRefresh from the Ready to Verify View (Barcode code page). Confirm you are taken to the account view.
Sign out.
Sign-in via Login.gov (Verify application navigates to the account page). Sign out.
Sign-in via Sinatra (Verify application navigates to the verification welcome page ie: /verify/welcome)
Step through IPP to successfully create a barcode
Scenario 4: Handle Unsupported Secondary ID Type
Create an enrollment- get to Ready to Verify (barcode page)
In your terminal open the rails console
Verify that the enrollment is updated to status is failed.
eVerify that the profile associated with the enrollment is not active (active = false), in_person_verification_pending_at is nil, and the deactivation_reason is verification_cancelled.
e.profileRefresh from the Ready to Verify View (Barcode code page). Confirm you are taken to the account view.
Sign out.
Sign-in via Login.gov (Verify application navigates to the account page). Sign out.
Sign-in via Sinatra (Verify application navigates to the verification welcome page ie: /verify/welcome)
Step through IPP to successfully create a barcode
Notes:
We used this doc to work through changes.