From 919530d8120e10a68bbd147ad643115af2fc5c1a Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Thu, 18 Apr 2024 21:29:22 +0000 Subject: [PATCH 1/3] chore(enrollment): update copy on retry page --- benefits/enrollment/templates/enrollment/retry.html | 4 ++-- benefits/locale/en/LC_MESSAGES/django.po | 8 +++++--- benefits/locale/es/LC_MESSAGES/django.po | 12 ++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/benefits/enrollment/templates/enrollment/retry.html b/benefits/enrollment/templates/enrollment/retry.html index 4efb402f8..5872ac7b9 100644 --- a/benefits/enrollment/templates/enrollment/retry.html +++ b/benefits/enrollment/templates/enrollment/retry.html @@ -13,12 +13,12 @@

{% include "core/includes/icon.html" with name="bankcardquestion" %} - {% translate "We couldn’t connect your card" %} + {% translate "The card information may not have been entered correctly." %}

-

{% translate "You can try again or reach out to your transit provider for assistance." %}

+

{% translate "Please check the details on your card and try again, or contact your transit agency for help." %}

diff --git a/benefits/locale/en/LC_MESSAGES/django.po b/benefits/locale/en/LC_MESSAGES/django.po index 0c649a26a..adc82fd81 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-18 14:01-0700\n" +"POT-Creation-Date: 2024-04-18 14:27-0700\n" "Language: English\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -587,10 +587,12 @@ msgstr "" msgid "Unable to register card" msgstr "" -msgid "We couldn’t connect your card" +msgid "The card information may not have been entered correctly." msgstr "" -msgid "You can try again or reach out to your transit provider for assistance." +msgid "" +"Please check the details on your card and try again, or contact your transit " +"agency for help." msgstr "" msgid "Try again" diff --git a/benefits/locale/es/LC_MESSAGES/django.po b/benefits/locale/es/LC_MESSAGES/django.po index a4e845b10..b4e9985ca 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-18 14:01-0700\n" +"POT-Creation-Date: 2024-04-18 14:27-0700\n" "Language: Español\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -705,13 +705,13 @@ msgstr "Conecta su tarjeta" msgid "Unable to register card" msgstr "No se pudo registrar la tarjeta" -msgid "We couldn’t connect your card" -msgstr "No pudimos conectar su tarjeta" +msgid "The card information may not have been entered correctly." +msgstr "" -msgid "You can try again or reach out to your transit provider for assistance." +msgid "" +"Please check the details on your card and try again, or contact your transit " +"agency for help." msgstr "" -"Puede intentarlo de nuevo o comunicarse con su proveedor de transporte local " -"para obtener ayuda." msgid "Try again" msgstr "Intentar otra vez" From 3594df4b3494fe00e960aac6c5af562c58fbb735 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Thu, 18 Apr 2024 21:44:41 +0000 Subject: [PATCH 2/3] refactor(enrollment): retry responds to GET and POST this change simplifies the view logic and updates the corresponding tests throwing an error on GET is unnecessary: the behavior was a kind of an assertion on how the user got to the /retry route, but in fact it doesn't really matter if they made a GET or POST. Supporting GET makes testing the route easier too. --- benefits/enrollment/views.py | 13 ++----------- tests/pytest/enrollment/test_views.py | 23 +++++++---------------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/benefits/enrollment/views.py b/benefits/enrollment/views.py index ddf8a2cdf..0d27ea3d2 100644 --- a/benefits/enrollment/views.py +++ b/benefits/enrollment/views.py @@ -212,17 +212,8 @@ def reenrollment_error(request): @decorator_from_middleware(EligibleSessionRequired) def retry(request): """View handler for a recoverable failure condition.""" - if request.method == "POST": - analytics.returned_retry(request) - form = forms.CardTokenizeFailForm(request.POST) - if form.is_valid(): - return TemplateResponse(request, TEMPLATE_RETRY) - else: - analytics.returned_error(request, "Invalid retry submission.") - raise Exception("Invalid retry submission.") - else: - analytics.returned_error(request, "This view method only supports POST.") - raise Exception("This view method only supports POST.") + analytics.returned_retry(request) + return TemplateResponse(request, TEMPLATE_RETRY) @pageview_decorator diff --git a/tests/pytest/enrollment/test_views.py b/tests/pytest/enrollment/test_views.py index 2c3f2b886..1770f842b 100644 --- a/tests/pytest/enrollment/test_views.py +++ b/tests/pytest/enrollment/test_views.py @@ -623,28 +623,19 @@ def test_retry_ineligible(client): @pytest.mark.django_db -@pytest.mark.usefixtures("mocked_session_eligibility") -def test_retry_get(client): +@pytest.mark.usefixtures("mocked_session_agency", "mocked_session_eligibility") +def test_retry_get(client, mocked_analytics_module): path = reverse(ROUTE_RETRY) - with pytest.raises(Exception, match=r"POST"): - client.get(path) - - -@pytest.mark.django_db -@pytest.mark.usefixtures("mocked_session_eligibility") -def test_retry_invalid_form(mocker, client): - mocker.patch("benefits.enrollment.views.forms.CardTokenizeFailForm.is_valid", return_value=False) + response = client.get(path) - path = reverse(ROUTE_RETRY) - with pytest.raises(Exception, match=r"Invalid"): - client.post(path) + assert response.status_code == 200 + assert response.template_name == TEMPLATE_RETRY + mocked_analytics_module.returned_retry.assert_called_once() @pytest.mark.django_db @pytest.mark.usefixtures("mocked_session_agency", "mocked_session_eligibility") -def test_retry_valid_form(mocker, client, mocked_analytics_module): - mocker.patch("benefits.enrollment.views.forms.CardTokenizeFailForm.is_valid", return_value=True) - +def test_retry_valid_form(client, mocked_analytics_module): path = reverse(ROUTE_RETRY) response = client.post(path) From a6bf318dd4e02e44ed27182959efbedf8af79faa Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Thu, 18 Apr 2024 21:47:08 +0000 Subject: [PATCH 3/3] chore(enrollment): 24px between icon and headline --- benefits/enrollment/templates/enrollment/retry.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefits/enrollment/templates/enrollment/retry.html b/benefits/enrollment/templates/enrollment/retry.html index 5872ac7b9..53d1941ba 100644 --- a/benefits/enrollment/templates/enrollment/retry.html +++ b/benefits/enrollment/templates/enrollment/retry.html @@ -12,7 +12,7 @@

- {% include "core/includes/icon.html" with name="bankcardquestion" %} + {% include "core/includes/icon.html" with name="bankcardquestion" %} {% translate "The card information may not have been entered correctly." %}