identity-idp icon indicating copy to clipboard operation
identity-idp copied to clipboard

LG-12069 Deactivate profile if a user never visits the Post Office

Open KeithNava opened this issue 1 year ago • 1 comments

🎫 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_tmx by setting it's value to true in config/application.yml https://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 Screenshot 2024-02-23 at 9 54 01 AM

  • [x] Setup the mocks to mimic USPS sending an expired error message by replacing the request_proofing_results method 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_events or I guess you could just look at the log/events.log you 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 GetUspsProofingResultsJob by 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_at set to nil and has a timestamp set on the fraud_rejection_at field. Screenshot 2024-02-22 at 6 46 33 PM

  • [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 the events.log file.

  • [x] Dance and pat yourself on the back, you did a lot! Thank you! ⭐

KeithNava avatar Feb 07 '24 21:02 KeithNava

@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

gina-yamada avatar Feb 29 '24 23:02 gina-yamada

Thanks everyone for the thoughtful and thorough review! 🙏

KeithNava avatar Mar 04 '24 16:03 KeithNava