-
Notifications
You must be signed in to change notification settings - Fork 166
LG-362 LOA3 fail states #2259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
LG-362 LOA3 fail states #2259
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
390d185
Make the generic failure template a partial
davemcorwin 22c5862
Update jurisdiction fail screens
davemcorwin a4a746f
Fix translations;
davemcorwin 02d7622
Explicitly set translations as used
davemcorwin 377dacc
Lint fixes
davemcorwin 901e994
Merge branch 'master' into LG-362-idv-attempts-fail-screen
davemcorwin c27fdf9
Update profile attempts fail screen
davemcorwin 541a955
Update specs
davemcorwin 041db2d
Merge branch 'master' into LG-362-idv-attempts-fail-screen
davemcorwin 7ad119a
WIP
davemcorwin 530e8f4
A lot of cleanup
davemcorwin 9f0d483
Fix specs
davemcorwin 5c857ee
Merge branch 'master' into LG-362-idv-attempts-fail-screen
davemcorwin b9dff27
Rubocop fixes
davemcorwin 556762d
Rubocop fix
davemcorwin eef8367
Add presenter specs
davemcorwin 3173d54
Update spec, i18n path
davemcorwin fd88f8c
More presenter specs
davemcorwin cdd535d
Merge branch 'master' into LG-362-idv-attempts-fail-screen
davemcorwin 11539dd
Add failure specs to sessions controller spec
davemcorwin 551d914
Fix SP return urls
davemcorwin 66a287c
Add timeout example to moc resolution proofer
davemcorwin 4b388b2
Fix spec
davemcorwin 429211c
Fix spec again
davemcorwin aa4f705
Exclude proofer mocks from test coverage
davemcorwin 800c5e7
Merge branch 'master' into LG-362-idv-attempts-fail-screen
davemcorwin ea0a130
Merge branch 'master' into LG-362-idv-attempts-fail-screen
jmhooper da4ba0e
clean up failure urls and add form before actions
jmhooper 081f08b
fix some tests
jmhooper b6c1384
reduce cognition
jmhooper 9c79ef1
rename other failure to verification failure
jmhooper d8d26cb
Use the accessor for `idv_form` not the instance variable
davemcorwin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,54 @@ | ||
| module IdvFailureConcern | ||
| extend ActiveSupport::Concern | ||
|
|
||
| # rubocop:disable Metrics/MethodLength | ||
| def render_failure | ||
| if step_attempts_exceeded? | ||
| @view_model = view_model(error: 'fail') | ||
| flash_message(type: :error) | ||
| elsif step.vendor_validator_job_failed? | ||
| @view_model = view_model(error: 'jobfail') | ||
| flash_message(type: :warning) | ||
| elsif form_valid_but_vendor_validation_failed? | ||
| @view_model = view_model(error: 'warning', timed_out: step.vendor_validation_timed_out?) | ||
| flash_message(type: :warning) | ||
| else | ||
| @view_model = view_model | ||
| end | ||
| end | ||
| # rubocop:enable Metrics/MethodLength | ||
|
|
||
| def form_valid_but_vendor_validation_failed? | ||
| idv_form.valid? && !step.vendor_validation_passed? | ||
| end | ||
|
|
||
| def flash_message(type:) | ||
| flash.now[type.to_sym] = @view_model.flash_message | ||
| end | ||
|
|
||
| def view_model(error: nil, timed_out: nil) | ||
| view_model_class.new( | ||
| error: error, | ||
| def idv_step_failure_reason | ||
| return :fail if fail? | ||
| return :jobfail if jobfail? | ||
| return :timeout if timeout? | ||
| return :warning if warning? | ||
| end | ||
|
|
||
| def render_idv_step_failure(step, reason) | ||
| return render_failure('shared/_failure', failure_presenter(step)) if reason == :fail | ||
| render_failure('idv/shared/verification_failure', warning_presenter(step, reason)) | ||
| end | ||
|
|
||
| def render_failure(template, presenter) | ||
| render_full_width(template, locals: { presenter: presenter }) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def fail? | ||
| idv_attempter.exceeded? || step_attempts_exceeded? | ||
| end | ||
|
|
||
| def jobfail? | ||
| step.vendor_validator_job_failed? | ||
| end | ||
|
|
||
| def timeout? | ||
| !step.vendor_validation_passed? && step.vendor_validation_timed_out? | ||
| end | ||
|
|
||
| def warning? | ||
| !step.vendor_validation_passed? && !step.vendor_validation_timed_out? | ||
| end | ||
|
|
||
| def failure_presenter(step) | ||
| Idv::MaxAttemptsFailurePresenter.new( | ||
| decorated_session: decorated_session, | ||
| step_name: step, | ||
| view_context: view_context | ||
| ) | ||
| end | ||
|
|
||
| def warning_presenter(step, reason) | ||
| Idv::WarningPresenter.new( | ||
| reason: reason, | ||
| remaining_attempts: remaining_step_attempts, | ||
| idv_form: idv_form, | ||
| timed_out: timed_out | ||
| step_name: step, | ||
| view_context: view_context | ||
| ) | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like we have cases that need a
failure_url?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used by a few of the IdV concerns: