LG-12376 state id update - check ssn#10567
Conversation
|
|
||
| def updating_state_id? | ||
| pii_from_user.has_key?(:first_name) | ||
| pii_from_user.has_key?(:first_name) && !user_session[:idv][:ssn].nil? |
There was a problem hiding this comment.
Can we add some test coverage for this change?
Also, is user_session[:idv] guaranteed to exist so that we don't run into an error undefined method []' for nil, or should we use dig` instead?
| pii_from_user.has_key?(:first_name) && !user_session[:idv][:ssn].nil? | |
| pii_from_user.has_key?(:first_name) && user_session.dig(:idv, :ssn).present? |
There was a problem hiding this comment.
i made this update and also added test coverage
aduth
left a comment
There was a problem hiding this comment.
Trying to understand the problem this is addressing, it sounds like we're setting values into the session even when the submission is considered invalid? To me, that sounds like the bigger issue, and we should only be assigning values if the submission is valid.
@aduth that's a good point. I think we were originally doing it like this because we needed the value for same_address_as_id for the submitted event. It does make sense though to move both of those things so that they're only done when the form submission is valid. |
🎫 Ticket
Link to the relevant ticket:
LG-12376
🛠 Summary of changes
This pr fixes a bug introduced into the 1st pr addressing the update route for the state id controller. We are now also checking that there is an ssn for the user as a means to determine if the user is updating their id information. Previously we did not check the ssn value and so if a user had entered their name on the page but validation failed the page would change to show the appropriate view for someone who is now updating the page.
📜 Testing Plan
Provide a checklist of steps to confirm the changes.