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/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/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/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..1fe235f7c 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 4c81971df..a5b476752 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) @@ -119,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": @@ -171,4 +171,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/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 " 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", () => { 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"