LG-12069 Deactivate profile if a user never visits the Post Office
🎫 Ticket
Link to the relevant ticket: LG-12069
🛠 Summary of changes
- Added logic for deactivating a profile if the deadline passes to visit the post office
📜 Testing Plan
-
[ ] Enable feature flag
in_person_proofing_enforce_tmxby setting it's value to true inconfig/application.ymlhttps://github.com/18F/identity-idp/blob/22aa3b1a13357be1153d7fa6c50f5b07043b8b3e/config/application.yml.default#L136 -
[ ] Create enrollment that is under fraud review by selecting the "Review" option in the mock device profiling dropdown on the SSN page
-
[x] Setup the mocks to mimic USPS sending an expired error message by replacing the
request_proofing_resultsmethod in the mock proofer (https://github.com/18F/identity-idp/blob/c2afe07653a46e59a08dfabba5e382a19c139e8b/app/services/usps_in_person_proofing/mock/proofer.rb#L34) with the following
def request_proofing_results(_unique_id, _enrollment_code)
body = JSON.parse(Fixtures.request_expired_proofing_results_response)
response = { body: body, status: 400 }
raise Faraday::BadRequestError.new('Bad request error', response)
end
- [x] In a new terminal session, open the rails console
$ rails console # or rails c if you're wild - [x] In yet another terminal session, start watching the events
$ make watch_eventsor I guess you could just look at thelog/events.logyou are the one in charge after all, I'm just a bunch text that you've probably been reading too long. Now for the exciting part! - [x] Setup the enrollment's profile you just created to be picked up by the
GetUspsProofingResultsJobby running the following:
require 'active_support/testing/time_helpers'
include ActiveSupport::Testing::TimeHelpers
freeze_time
now = Time.zone.now
current_enrollment = InPersonEnrollment.last # Most likely if you haven’t created a new enrollment in the middle of testing cuz that would be weird but if you have just grab the enrollment in your preferred way you rebel you!
current_enrollment.update(last_batch_claimed_at: now)
-
[x] Start the job! In the same rails console run:
GetUspsProofingResultsJob.new.perform(now) -
[x] Ensure that your enrollment's profile is not active, has the
in_person_verification_pending_atset toniland has a timestamp set on thefraud_rejection_atfield. -
[x] Also notice the
idv_in_person_usps_proofing_results_job_user_deactivated_deadline_passed(aka the longest log name ever. I'm so open to renaming this you don't even know) analytics has been logged in the terminal watching the events and / or in theevents.logfile. -
[x] Dance and pat yourself on the back, you did a lot! Thank you! ⭐
@KeithNava You are almost there! Check out Joy Norms- Things to check before creating your pull request- Changelog. Also, the attached guideline document and script in that section is helpful
Thanks everyone for the thoughtful and thorough review! 🙏