Skip to content
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

Feat: error templates for in-person enrollment #2382

Merged
merged 6 commits into from
Sep 23, 2024

Conversation

angela-tran
Copy link
Member

@angela-tran angela-tran commented Sep 19, 2024

Closes #2345

This PR implements the templates for in-person error pages and also adds the call to send a Sentry notification for those errors.

Testing locally

You can view the pages by going directly to the URLs:

  • system error: in_person/enrollment/error
  • server error: in_person/error
  • re-enrollment error: in_person/enrollment/error/reenrollment
  • user enrollment error: in_person/enrollment/retry

If you want to test the actual view redirecting logic, you'll need to simulate the errors.

You can simulate errors by changing the returned Status and exception on this line:

status, exception = enroll(request, card_token)

For re-enrollment errors, you also need the dates to be populated, so:

  • (Temporarily) override the value returned by session.enrollment_expiry() e.g.
expiry = datetime(2025, 9, 20, tzinfo=timezone.utc).timestamp()
if expiry:
    return datetime.fromtimestamp(expiry, tz=timezone.utc)
else:
    return None
  • In the Admin, update the flow that you plan to test with:
    • check supports expiration
    • add a value for the expiration days and re-enrollment days

Don't forget that there are also the onVerificationFailure and onError callback functions in the front-end that will redirect to error pages as well.

Screenshots

Expand

System error

image

Server error

image

Re-enrollment error

image

User enrollment error

image

@angela-tran angela-tran self-assigned this Sep 19, 2024
@github-actions github-actions bot added front-end HTML/CSS/JavaScript and Django templates back-end Django views, sessions, middleware, models, migrations etc. labels Sep 19, 2024
@angela-tran angela-tran force-pushed the feat/success-in-person-enrollment branch from f599067 to c3292aa Compare September 19, 2024 23:03
@angela-tran angela-tran force-pushed the feat/errors-in-person-enrollment branch 2 times, most recently from d98a600 to e880258 Compare September 20, 2024 16:41
Copy link

github-actions bot commented Sep 20, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/in_person
  views.py
Project Total  

This report was generated by python-coverage-comment-action

@angela-tran angela-tran force-pushed the feat/errors-in-person-enrollment branch from e880258 to 4073ec5 Compare September 20, 2024 19:09
Base automatically changed from feat/success-in-person-enrollment to main September 20, 2024 19:09
@angela-tran angela-tran force-pushed the feat/errors-in-person-enrollment branch from e6af3db to 8ef7dd1 Compare September 20, 2024 20:04
@angela-tran angela-tran marked this pull request as ready for review September 20, 2024 20:05
@angela-tran angela-tran requested a review from a team as a code owner September 20, 2024 20:05
Copy link
Member

@lalver1 lalver1 left a comment

Choose a reason for hiding this comment

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

Looks good to me! I tested by simulating the errors and everything worked as expected 👍

@thekaveman
Copy link
Member

Looking at this 👀

Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

I simulated all the errors locally and this looks great.

Minor suggestion, but non-blocking.

@@ -133,22 +136,38 @@ def enrollment(request):

Copy link
Member

Choose a reason for hiding this comment

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

commenting on the line just below the line I'm talking about, since it isn't available for comment

return TemplateResponse(request, "in_person/enrollment.html", context)

Minor suggestion, now that an in_person/templates/in_person/enrollment/ directory exists, maybe we should move this enrollment.html template in there as index.html.

@angela-tran angela-tran merged commit fed968b into main Sep 23, 2024
15 checks passed
@angela-tran angela-tran deleted the feat/errors-in-person-enrollment branch September 23, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc. front-end HTML/CSS/JavaScript and Django templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle errors during in-person enrollment
3 participants