From 7b2838682d764fbac7154325c04a5755df5dc45f Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Wed, 24 Apr 2024 21:17:16 +0000 Subject: [PATCH 1/4] refactor(model): allow for using a different unverified template --- ..._eligibilityverifier_unverified_template.py | 18 ++++++++++++++++++ benefits/core/models.py | 1 + benefits/eligibility/views.py | 3 +-- tests/pytest/eligibility/test_views.py | 3 +-- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 benefits/core/migrations/0008_eligibilityverifier_unverified_template.py diff --git a/benefits/core/migrations/0008_eligibilityverifier_unverified_template.py b/benefits/core/migrations/0008_eligibilityverifier_unverified_template.py new file mode 100644 index 000000000..f8ac08403 --- /dev/null +++ b/benefits/core/migrations/0008_eligibilityverifier_unverified_template.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.3 on 2024-04-24 21:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0007_eligibilitytype_enrollment_index_template"), + ] + + operations = [ + migrations.AddField( + model_name="eligibilityverifier", + name="unverified_template", + field=models.TextField(default="eligibility/unverified.html"), + ), + ] diff --git a/benefits/core/models.py b/benefits/core/models.py index 1d3cbacff..a2f763c29 100644 --- a/benefits/core/models.py +++ b/benefits/core/models.py @@ -178,6 +178,7 @@ class EligibilityVerifier(models.Model): start_template = models.TextField(null=True, blank=True) # reference to a form class used by this Verifier, e.g. benefits.app.forms.FormClass form_class = models.TextField(null=True, blank=True) + unverified_template = models.TextField(default="eligibility/unverified.html") help_template = models.TextField(null=True, blank=True) class Meta: diff --git a/benefits/eligibility/views.py b/benefits/eligibility/views.py index 4c81971df..e56792e6d 100644 --- a/benefits/eligibility/views.py +++ b/benefits/eligibility/views.py @@ -24,7 +24,6 @@ TEMPLATE_START = "eligibility/start.html" TEMPLATE_CONFIRM = "eligibility/confirm.html" -TEMPLATE_UNVERIFIED = "eligibility/unverified.html" @decorator_from_middleware(RecaptchaEnabled) @@ -171,4 +170,4 @@ def unverified(request): analytics.returned_fail(request, types_to_verify) - return TemplateResponse(request, TEMPLATE_UNVERIFIED) + return TemplateResponse(request, verifier.unverified_template) diff --git a/tests/pytest/eligibility/test_views.py b/tests/pytest/eligibility/test_views.py index ea55ad460..4cc08407e 100644 --- a/tests/pytest/eligibility/test_views.py +++ b/tests/pytest/eligibility/test_views.py @@ -12,7 +12,6 @@ ROUTE_ENROLLMENT, ROUTE_UNVERIFIED, TEMPLATE_CONFIRM, - TEMPLATE_UNVERIFIED, ) import benefits.eligibility.views @@ -343,4 +342,4 @@ def test_unverified(client, mocked_analytics_module): mocked_analytics_module.returned_fail.assert_called_once() assert response.status_code == 200 - assert response.template_name == TEMPLATE_UNVERIFIED + assert response.template_name == "eligibility/unverified.html" From 58fd08539d49f48761d1dd444eb9233ca9470576 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Wed, 24 Apr 2024 21:33:55 +0000 Subject: [PATCH 2/4] feat: implement agency-card-specific templates for unverified view the call-to-action takes the user back to the confirm form. --- benefits/core/migrations/local_fixtures.json | 2 ++ .../unverified--mst-courtesy-card.html | 15 ++++++++++++ .../unverified--sbmtd-mobility-pass.html | 15 ++++++++++++ .../templates/eligibility/unverified.html | 18 +++++++++------ benefits/eligibility/views.py | 1 + benefits/locale/en/LC_MESSAGES/django.po | 23 +++++++++++++++---- benefits/locale/es/LC_MESSAGES/django.po | 23 +++++++++++++++---- 7 files changed, 82 insertions(+), 15 deletions(-) create mode 100644 benefits/eligibility/templates/eligibility/unverified--mst-courtesy-card.html create mode 100644 benefits/eligibility/templates/eligibility/unverified--sbmtd-mobility-pass.html diff --git a/benefits/core/migrations/local_fixtures.json b/benefits/core/migrations/local_fixtures.json index 4e047041d..a3a8829df 100644 --- a/benefits/core/migrations/local_fixtures.json +++ b/benefits/core/migrations/local_fixtures.json @@ -187,6 +187,7 @@ "selection_label_template": "eligibility/includes/selection-label--mst-courtesy-card.html", "start_template": "eligibility/start--mst-courtesy-card.html", "form_class": "benefits.eligibility.forms.MSTCourtesyCard", + "unverified_template": "eligibility/unverified--mst-courtesy-card.html", "help_template": "core/includes/help--mst-courtesy-card.html" } }, @@ -251,6 +252,7 @@ "selection_label_template": "eligibility/includes/selection-label--sbmtd-mobility-pass.html", "start_template": "eligibility/start--sbmtd-mobility-pass.html", "form_class": "benefits.eligibility.forms.SBMTDMobilityPass", + "unverified_template": "eligibility/unverified--sbmtd-mobility-pass.html", "help_template": "core/includes/help--sbmtd-mobility-pass.html" } }, diff --git a/benefits/eligibility/templates/eligibility/unverified--mst-courtesy-card.html b/benefits/eligibility/templates/eligibility/unverified--mst-courtesy-card.html new file mode 100644 index 000000000..b1b710d38 --- /dev/null +++ b/benefits/eligibility/templates/eligibility/unverified--mst-courtesy-card.html @@ -0,0 +1,15 @@ +{% extends "eligibility/unverified.html" %} +{% load i18n %} + +{% block unverified-headline %} + {% translate "Your card information may not have been entered correctly." %} +{% endblock unverified-headline %} + +{% block unverified-body %} + {% translate "The number and last name must be entered exactly as they appear on your MST Courtesy Card. Please check your card and try again, or contact your transit agency for help." %} +{% endblock unverified-body %} + +{% block unverified-call-to-action %} + {% translate "Try again" as button_text %} +
{% include "core/includes/button--origin.html" with button_text=button_text %}
+{% endblock unverified-call-to-action %} diff --git a/benefits/eligibility/templates/eligibility/unverified--sbmtd-mobility-pass.html b/benefits/eligibility/templates/eligibility/unverified--sbmtd-mobility-pass.html new file mode 100644 index 000000000..828fa1803 --- /dev/null +++ b/benefits/eligibility/templates/eligibility/unverified--sbmtd-mobility-pass.html @@ -0,0 +1,15 @@ +{% extends "eligibility/unverified.html" %} +{% load i18n %} + +{% block unverified-headline %} + {% translate "Your card information may not have been entered correctly." %} +{% endblock unverified-headline %} + +{% block unverified-body %} + {% translate "The number and last name must be entered exactly as they appear on your SBMTD Reduced Fare Mobility ID card. Please check your card and try again, or contact your transit agency for help." %} +{% endblock unverified-body %} + +{% block unverified-call-to-action %} + {% translate "Try again" as button_text %} +
{% include "core/includes/button--origin.html" with button_text=button_text %}
+{% endblock unverified-call-to-action %} diff --git a/benefits/eligibility/templates/eligibility/unverified.html b/benefits/eligibility/templates/eligibility/unverified.html index 1b7ce999a..232fd3b82 100644 --- a/benefits/eligibility/templates/eligibility/unverified.html +++ b/benefits/eligibility/templates/eligibility/unverified.html @@ -12,17 +12,19 @@

- - {% include "core/includes/icon.html" with name="idcardquestion" %} - - {% translate "Your eligibility could not be verified." %} + {% include "core/includes/icon.html" with name="idcardquestion" %} + {% block unverified-headline %} + {% translate "Your eligibility could not be verified." %} + {% endblock unverified-headline %}

- {% translate "That’s okay! You may still be eligible for our program." %} - {% blocktranslate with short_name=agency.short_name %}Please reach out to {{ short_name }} for assistance.{% endblocktranslate %} + {% block unverified-body %} + {% translate "That’s okay! You may still be eligible for our program." %} + {% blocktranslate with short_name=agency.short_name %}Please reach out to {{ short_name }} for assistance.{% endblocktranslate %} + {% endblock unverified-body %}

@@ -32,7 +34,9 @@

-
{% include "core/includes/button--index.html" %}
+ {% block unverified-call-to-action %} +
{% include "core/includes/button--index.html" %}
+ {% endblock unverified-call-to-action %}
diff --git a/benefits/eligibility/views.py b/benefits/eligibility/views.py index e56792e6d..a5b476752 100644 --- a/benefits/eligibility/views.py +++ b/benefits/eligibility/views.py @@ -118,6 +118,7 @@ def confirm(request): # GET from an unverified user, present the form if request.method == "GET": + session.update(request, origin=reverse(ROUTE_CONFIRM)) return TemplateResponse(request, TEMPLATE_CONFIRM, context) # POST form submission, process form data, make Eligibility Verification API call elif request.method == "POST": diff --git a/benefits/locale/en/LC_MESSAGES/django.po b/benefits/locale/en/LC_MESSAGES/django.po index b64c217d4..71d0c92be 100644 --- a/benefits/locale/en/LC_MESSAGES/django.po +++ b/benefits/locale/en/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n" -"POT-Creation-Date: 2024-04-26 16:57+0000\n" +"POT-Creation-Date: 2024-04-25 13:54-0700\n" "Language: English\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -533,6 +533,24 @@ msgstr "" msgid "You will need a few items to continue:" msgstr "" +msgid "Your card information may not have been entered correctly." +msgstr "" + +msgid "" +"The number and last name must be entered exactly as they appear on your MST " +"Courtesy Card. Please check your card and try again, or contact your transit " +"agency for help." +msgstr "" + +msgid "Try again" +msgstr "" + +msgid "" +"The number and last name must be entered exactly as they appear on your " +"SBMTD Reduced Fare Mobility ID card. Please check your card and try again, " +"or contact your transit agency for help." +msgstr "" + msgid "Unable to confirm eligibility" msgstr "" @@ -608,9 +626,6 @@ msgid "" "agency for help." msgstr "" -msgid "Try again" -msgstr "" - msgid "" "You were not charged anything today. When boarding an MST fixed route bus, " "tap this card when you board and you will be charged a reduced fare. You " diff --git a/benefits/locale/es/LC_MESSAGES/django.po b/benefits/locale/es/LC_MESSAGES/django.po index 71ace160e..964c902cf 100644 --- a/benefits/locale/es/LC_MESSAGES/django.po +++ b/benefits/locale/es/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n" -"POT-Creation-Date: 2024-04-26 16:57+0000\n" +"POT-Creation-Date: 2024-04-25 13:54-0700\n" "Language: Español\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -643,6 +643,24 @@ msgstr "Ha seleccionado un beneficio de tránsito para veteranos." msgid "You will need a few items to continue:" msgstr "Necesitará algunos artículos para continuar:" +msgid "Your card information may not have been entered correctly." +msgstr "" + +msgid "" +"The number and last name must be entered exactly as they appear on your MST " +"Courtesy Card. Please check your card and try again, or contact your transit " +"agency for help." +msgstr "" + +msgid "Try again" +msgstr "Intentar otra vez" + +msgid "" +"The number and last name must be entered exactly as they appear on your " +"SBMTD Reduced Fare Mobility ID card. Please check your card and try again, " +"or contact your transit agency for help." +msgstr "" + msgid "Unable to confirm eligibility" msgstr "No se pudo confirmar la elegibilidad" @@ -724,9 +742,6 @@ msgid "" "agency for help." msgstr "" -msgid "Try again" -msgstr "Intentar otra vez" - msgid "" "You were not charged anything today. When boarding an MST fixed route bus, " "tap this card when you board and you will be charged a reduced fare. You " From 32400034f09348d501de3fb5e65a681460b52b02 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Thu, 25 Apr 2024 21:01:48 +0000 Subject: [PATCH 3/4] chore: update a string in courtesy-card Cypress test --- tests/cypress/specs/courtesy-cards.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/specs/courtesy-cards.cy.js b/tests/cypress/specs/courtesy-cards.cy.js index e2f6b2f77..823f1db60 100644 --- a/tests/cypress/specs/courtesy-cards.cy.js +++ b/tests/cypress/specs/courtesy-cards.cy.js @@ -26,7 +26,7 @@ describe("Courtesy Cards", () => { cy.get("#name").type(users.ineligible.name); cy.get("#form-eligibility-verification button[type='submit']").click(); - cy.contains("could not be verified"); + cy.contains("may not have been entered correctly"); }); it("Validates an empty name field", () => { From 6ad689480f670e4bf326c64af749a84a746a40ec Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Thu, 25 Apr 2024 21:03:26 +0000 Subject: [PATCH 4/4] style(unverified): use 24px between icon and text --- benefits/eligibility/templates/eligibility/unverified.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefits/eligibility/templates/eligibility/unverified.html b/benefits/eligibility/templates/eligibility/unverified.html index 232fd3b82..1fe235f7c 100644 --- a/benefits/eligibility/templates/eligibility/unverified.html +++ b/benefits/eligibility/templates/eligibility/unverified.html @@ -12,7 +12,7 @@

- {% include "core/includes/icon.html" with name="idcardquestion" %} + {% include "core/includes/icon.html" with name="idcardquestion" %} {% block unverified-headline %} {% translate "Your eligibility could not be verified." %} {% endblock unverified-headline %}