Skip to content

Separate idv_form from Idv::Step classes#1520

Merged
zachmargolis merged 1 commit intomasterfrom
margolis-remove-idv-form
Jul 3, 2017
Merged

Separate idv_form from Idv::Step classes#1520
zachmargolis merged 1 commit intomasterfrom
margolis-remove-idv-form

Conversation

@zachmargolis
Copy link
Contributor

Why:
This will let us break submission in to two steps and
into two controller actions which will further help us
when we move the call to our vendors to background
jobs.

--

Before: the step classes combined results from idv_form as well as vendor_validator (which calls out to the vendor).

Now: the step classes just wrap the vendor validator and the associated side effects.

Next:

  • Make the step classes take the vendor_result as input
  • Move the call to the vendor to a background job
  • Split the #create actions into #create and #show where the #show action can poll for the result and then submit to the Step classes if ready

Open questions:

  • How do we want to handle analytics? Should we have a separate event for each step? (form validation + vendor submission?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monfresh I'd love your feedback here

To keep the changeset as small as possible, I had the two form submissions use the same event name which resulted in hacks like this expect(...).twice.

My guess is that we'll want to split this into two events, one for the form submit and one for the vendor submit? Do you think we should address this now, or in a follow-up PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question. I think 2 events makes sense. If it doesn't add too much to this PR, I would say do it now, but I'll leave it up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll address that in this PR, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in dd4270d98e911f5ce4a187757da461089a5a9514, PTAL!

Copy link
Contributor

Choose a reason for hiding this comment

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

Why define this in the controllers instead of in the IdvFailuerConcern where it is invoked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well each form has a different name (ex idv_profile_form, idv_phone_form, idv_finance_form) ... so I guess I could just rename those to idv_form and then make it consistent again

Thanks for pointing this out, I'm fixing it now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in ff881b7bfe89aae16a8beea0e993c33ed7c50ec4

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this action doesn't communicate with the vendor, what do you think about replacing render_failure with @view_model = view_model since the first 2 conditions in render_failure will always be false here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, fixed in 34d939adde4b413ca33f558f37068cbcfb593dfb

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here about using @view_model = view_model.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we've separated the form submission from the vendor validation, should we make sure we have a controller or integration test that makes sure the attempts count is only incremented if the form submission passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Added some expectations to the controller spec in ea7de2b3a02d0491ef726c530d21116d837d2f54

Copy link
Contributor

Choose a reason for hiding this comment

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

CC says this is not tested. I confirmed locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! It's not called ever, I think I can remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

CC says this is not tested. I confirmed locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto, removing it

Copy link
Contributor

@monfresh monfresh left a comment

Choose a reason for hiding this comment

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

LGTM

@zachmargolis zachmargolis force-pushed the margolis-remove-idv-form branch from ea7de2b to d459ca4 Compare July 3, 2017 14:44
@zachmargolis
Copy link
Contributor Author

@monfresh thanks for the review! I just squashed the commits, if it LGTM can you hit the "approve" button?

**Why**:
This will let us break submission in to two steps and
into two controller actions which will further help us
when we move the call to our vendors to background
jobs.
@zachmargolis zachmargolis merged commit 4f45a37 into master Jul 3, 2017
@zachmargolis zachmargolis deleted the margolis-remove-idv-form branch July 3, 2017 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants