Skip to content

LG-6897/LG-6868/LG-6437: Set pending profile state for IPP#6634

Merged
aduth merged 9 commits intomainfrom
aduth-lg-6437-verify-entry-ipp
Jul 27, 2022
Merged

LG-6897/LG-6868/LG-6437: Set pending profile state for IPP#6634
aduth merged 9 commits intomainfrom
aduth-lg-6437-verify-entry-ipp

Conversation

@aduth
Copy link
Copy Markdown
Contributor

@aduth aduth commented Jul 26, 2022

Why: So that a user's profile is not activated until they complete the in-person enrollment, and any attempts to revisit the identity verification will present them with the instructions to proof in-person (after GPO confirmation if applicable).

Testing Instructions:

  1. Navigate to http://localhost:3000
  2. Sign in
  3. Navigate to http://localhost:3000/verify
  4. Complete proofing flow up to document capture
  5. Use attention result YAML test document as file upload
  6. Click Submit
  7. Click troubleshooting option to "Verify your ID in person at a Post Office"
  8. Complete proofing flow
    1. Optional: Choose to verify address by mail (click "Verify your address by mail instead" on the "Enter a phone number with your name on the plan" step)
  9. After the "You're ready to verify in person", return to account page by clicking the logo
  10. Navigate to http://localhost:3000/verify
  11. Observe that you see the "You're ready to verify in person" instructions

Screen recordings:

Finalizing GPO redirects to in person instructions:

gpo-finalization.mov

Navigating to /verify with pending profile shows instructions:

go-to-verify.mov

aduth added 2 commits July 26, 2022 15:56
**Why**: So that a user who is directed to verify their identity while already having begun an in-person proofing attempt will have the opportunity to view the instructions to proof in person again.

changelog: Upcoming Features, In-person proofing, Show in-person instructions on repeat visits
@aduth aduth changed the title LG-6437: Show "Ready to verify" page for pending IPP profile LG-6897/LG-6868/LG-6437: Set pending profile state for IPP Jul 27, 2022
@aduth aduth marked this pull request as ready for review July 27, 2022 01:18
@aduth aduth requested review from a team and NavaTim July 27, 2022 01:18
Copy link
Copy Markdown
Contributor

@sheldon-b sheldon-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

if user.present?
@extra_attributes ||= {
profile_pending: user.pending_profile?,
profile_pending: user.pending_profile? && user_bundle.gpo_address_verification?,
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.

Is this essentially disambiguating pending profiles due to in-person proofing and due to GPO verification?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in earlier iterations I had tried to avoid adding a new deactivation reason and reusing the existing verification_pending, disambiguating based on the profile address verification method. However, this couldn't account for a GPO + IPP profile, where we'd have an issue that we'd need to be able to mark the profile as GPO-complete + IPP-incomplete, something which didn't seem possible without the new deactivation reason.

So technically this change might not be necessary any longer. I could go either way about keeping it, since technically the other changes here sorta lean into the idea that "pending profile" = "gpo". On the other hand, there is some other existing code that this helps aligns toward:

if pending_profile? && idv_session.address_verification_mechanism == 'gpo'
idv_come_back_later_url

encryption_error: 2,
verification_pending: 3,
verification_cancelled: 4,
in_person_verification_pending: 5,
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.

Oh nice this makes sense

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.

Since the enums are plain ints in the Db, what about renaming 3 to gpo_verification_pending?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the enums are plain ints in the Db, what about renaming 3 to gpo_verification_pending?

Yeah, I think that makes sense. Along the same lines, in an earlier iteration I had also renamed the UserDecorator#pending_profile_requires_verification? method to pending_profile_requires_gpo_verification?. I have a feeling there's a lot of different references to this "pending" state, so I may want to be a bit conservative with those updates for now. I think renaming the deactivation reason may be a good start for now at least.

Copy link
Copy Markdown
Contributor Author

@aduth aduth Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it may be worth noting that, in practice, "verification pending" is used exclusively to mean GPO verification, the process of creating and activating a profile does seem to treat it as a bit more generic, i.e. any new profile is pending by default until activated (see Idv::ProfileMaker#save_profile).

I wonder if we'd even need the deactivation_reason for the initialization of the profile? Or if we could just assume active: false would suffice on its own, and the GPO proofing path would be responsible for assigning that deactivation reason.

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 didn't realize that profiles start as pending like that. That makes me think maybe we would want to keep a single pending enum and maybe add a separate enum column for what it's waiting on (gpo, ipp, etc), unsure if deactivation reason is a super good fit for that? But it is already there.

Copy link
Copy Markdown
Contributor Author

@aduth aduth Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I was getting at with the second paragraph of my previous comment. It seems like we already have the two-field "pending" + "what it's waiting on" via active: false + deactivation_reason:. Currently, we initialize an active: false profile with deactivation_reason: :verification_pending, but I'm not sure there's a reason we have to?

In other words:

# New profile
Profile.new(active: false, deactivation_reason: nil)

# GPO verification profile
Profile.new(active: false, deactivation_reason: :gpo_verification_pending)

# IPP verification profile
Profile.new(active: false, deactivation_reason: :in_person_verification_pending)

# Active profile
Profile.new(active: true, deactivation_reason: nil)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed what I had in mind in 3dec5e2 . Also worth noting that with the logic flow for initializing a profile, the profile would immediately be either activated or assigned deactivation_reason: :gpo_verification_pending or deactivation_reason: :in_person_verification_pending depending on the route the user had selected during the proofing attempt.

idv_session.create_profile_from_applicant_with_password(password)
idv_session.cache_encrypted_pii(password)
idv_session.complete_session

Because of this, we could even consider changing save_profile to accept deactivation_reason as an optional argument and assign it at creation, which could have the added advantage of avoiding a second database update.

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.

Yeah that seems the clearest overall. And yes also updating save_profile to save a round trip seems worthwhile as well, maybe for a follow up PR if this one is getting bogged down

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this and follow-on with a few other improvements (more exhaustive specs, etc). I may do it there or in a follow-on-follow-on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this and follow-on with a few other improvements (more exhaustive specs, etc). I may do it there or in a follow-on-follow-on.

For posterity: #6680, #6681

Comment on lines +85 to +91
if phone_confirmed?
if pending_in_person_enrollment?
current_user.pending_profile&.deactivate(:in_person_verification_pending)
else
complete_profile
end
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.

👍

aduth and others added 4 commits July 26, 2022 22:38
Co-authored-by: Sheldon Bachstein <sheldon.bachstein@gsa.gov>
So that we don't have to worry about "initial pending" being conflated with "gpo verification pending", and instead defer to `active: false` as indicator

See: #6634 (comment)
@aduth aduth merged commit cd464e7 into main Jul 27, 2022
@aduth aduth deleted the aduth-lg-6437-verify-entry-ipp branch July 27, 2022 16:59
sheldon-b pushed a commit that referenced this pull request Jul 27, 2022
* Create enrollment even in FSM v1 config

* Fix broken helper

* LG-6437: Show "Ready to verify" page for pending IPP profile

**Why**: So that a user who is directed to verify their identity while already having begun an in-person proofing attempt will have the opportunity to view the instructions to proof in person again.

changelog: Upcoming Features, In-person proofing, Show in-person instructions on repeat visits

* Use correct user pii session data

* Ensure IPP profiles don't get activated in fsm v1

* LG-6897/LG-6868/LG-6437: Set pending profile state for IPP

* Fix lint failure

changelog: Upcoming features, In-person proofing, enroll users in USPS IPP in FSM v1 flow

* Fix "clear and start over" with pending enrollment

* Add specs for IPP users

* Assert that account is not verified

* Fix password confirm controller spec considering GPO pending

* Move enrollment-creation to profile creation form

* Clarify reproofing instruction spec comment

Co-authored-by: Sheldon Bachstein <sheldon.bachstein@gsa.gov>

* Rename verification_pending to gpo_verification_pending

See: #6634 (comment)

* Initialize profile with nil deactivation_reason

So that we don't have to worry about "initial pending" being conflated with "gpo verification pending", and instead defer to `active: false` as indicator

See: #6634 (comment)

* Use proofing component to check IPP status

* Remove conflict error message

* Remove lint error message

* Fix merge conflicts

* Use proofing component instead of enrollment

* Save same_address_as_id to PII

* Stub PII using user profile

* Mock user session for profile creation form

* Fix line length lint error

* Use pii from session instead of user_session

* Only check the current GPO profile for IPP

Only checks the current pending profile for proofing components related
to IPP, just in case the user manages to create additional profiles
while they are awaiting GPO verification

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
@solipet solipet mentioned this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants