Add InPerson::AddressController to FlowPolicy#9794
Conversation
Setting :pii_from_user in flow_policy_spec is a temporary workaround while the in person flow still has steps in the Flow State Machine.
|
|
||
| def clear_future_steps! | ||
| flow_policy.undo_future_steps_from_controller!(controller: self.class) | ||
| def clear_future_steps!(controller: self.class) |
There was a problem hiding this comment.
I would vote for this to be a new method, clear_future_steps_from!(controller:) and have clear_future_steps! call that with self.class
| allow(subject).to receive(:pii_from_user).and_return(pii_from_user) | ||
| allow(subject).to receive(:flow_session).and_return(flow_session) | ||
| stub_sign_in(user) | ||
| subject.user_session['idv/in_person'] = flow_session |
There was a problem hiding this comment.
Since we're removing references to flow_session below, can we get rid of the let as well and just initialize this:
| subject.user_session['idv/in_person'] = flow_session | |
| subject.user_session['idv/in_person'] = { pii_from_user: pii_from_user } |
| stub_sign_in(user) | ||
| subject.user_session['idv/in_person'] = flow_session | ||
| subject.idv_session.welcome_visited = true | ||
| subject.idv_session.idv_consent_given = true |
| end | ||
|
|
||
| def update | ||
| # don't clear the ssn when updating address, clear after SsnController |
There was a problem hiding this comment.
Thanks for leaving comment- I understand b/c we talked about this but think it will be helpful to future devs
| end | ||
|
|
||
| # update Idv::DocumentCaptureController.step_info.next_steps to include | ||
| # :ipp_address instead of :ipp_ssn in delete PR |
There was a problem hiding this comment.
I think we talked about this but want to check that my understanding is correct. next_step should be the first non-FSM step. So currently- that is SSN. Upon delete- it will be address.
But still can't remember why not just keep it ipp_ssn b/c it is the next step in the flow
There was a problem hiding this comment.
The in person flow has DocumentCapture -> (several React steps) -> State ID -> Address (optional) -> SSN -> Verify Info. Eventually FlowPolicy will have :document_capture next_steps include :ipp_state_id when that's out of the FSM. We might need to wait to update it until then, actually, since Address is optional. It's going to take some fiddling to get all that right.
| flow_session[:pii_from_user][:address1] = nil | ||
| flow_session[:pii_from_user][:address2] = nil | ||
| flow_session[:pii_from_user][:city] = nil | ||
| flow_session[:pii_from_user][:zipcode] = nil | ||
| flow_session[:pii_from_user][:state] = nil |
There was a problem hiding this comment.
@svalexander, since the state_id step also sets these fields, I wonder if we shouldn't clear them here. What do you think?
There was a problem hiding this comment.
I think it's ok for now, especially since we're not yet including this step as a next step anywhere, so undo_step won't be called. And then if we always clear starting after SsnController for the in person steps that edit pii_from_user and ssn, it won't be a problem. But we'll have to give this more thought and see if we can come up with a better solution.
…ller-add-flow-policy
🛠 Summary of changes
Add InPerson::AddressController to FlowPolicy. This controller is being developed behind a feature flag to replace the in person AddressStep which is still in the Flow State Machine. It requires an addition to the FlowPolicy code to accommodate it: allow
clear_future_steps!in IdvStepConcern to specify a future controller, since for AddressController we do not want to clear the SSN if the user has already entered it.In
Idv::Session#ipp_document_capture_complete?it checks whetherpii_from_user[:address1]is present, not just whetherpii_from_useris present.Note that this PR does not fix back button issues on the in person flow. It just adds the new AddressController to FlowPolicy.
📜 Testing Plan
in_person_residential_address_controller_enabled: trueand restart serverin_person_residential_address_controller_enabled: falseand restart server