Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions benefits/core/models/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from multiselectfield import MultiSelectField

from benefits.core import context as core_context
from benefits.eligibility import context as eligibility_context
from benefits.enrollment import context as enrollment_context
from benefits.in_person import context as in_person_context

Expand Down Expand Up @@ -213,11 +212,6 @@ def selection_label_template(self):
else:
return f"{prefix}--{self.system_name}.html"

@property
def eligibility_unverified_context(self):
ctx = eligibility_context.eligibility_unverified.get(self.system_name)
return ctx.dict() if ctx else {}

@property
def uses_claims_verification(self):
"""True if this flow verifies via the Identity Gateway and has a scope and claim. False otherwise."""
Expand Down
3 changes: 0 additions & 3 deletions benefits/eligibility/context/__init__.py

This file was deleted.

35 changes: 0 additions & 35 deletions benefits/eligibility/context/flow.py

This file was deleted.

35 changes: 34 additions & 1 deletion benefits/eligibility/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,47 @@ def form_invalid(self, form):
return self.get(self.request)


@dataclass
class EligibilityUnverified:
headline_text: str
body_text: str
button_text: str

def dict(self):
return asdict(self)


class AgencyCardEligibilityUnverified(EligibilityUnverified):
def __init__(self, agency_card):
super().__init__(
headline_text=_("Your card information may not have been entered correctly."),
body_text=_(
"The number and last name must be entered exactly as they appear on your {agency_card}. "
"Please check your card and try again, or contact your transit agency for help.",
agency_card=agency_card,
),
button_text=_("Try again"),
)


class UnverifiedView(AgencySessionRequiredMixin, FlowSessionRequiredMixin, TemplateView):
"""CBV for the unverified eligibility page."""

template_name = "eligibility/unverified.html"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update(self.flow.eligibility_unverified_context)

eligibility_unverified = {
SystemName.AGENCY_CARD.value: AgencyCardEligibilityUnverified(agency_card=_("CST Agency Card")),
SystemName.COURTESY_CARD.value: AgencyCardEligibilityUnverified(agency_card=_("MST Courtesy Card")),
SystemName.REDUCED_FARE_MOBILITY_ID.value: AgencyCardEligibilityUnverified(
agency_card=_("SBMTD Reduced Fare Mobility ID card")
),
}

context_object = eligibility_unverified.get(self.flow.system_name)
context.update(context_object.dict() if context_object else {})
return context

def get(self, request, *args, **kwargs):
Expand Down
46 changes: 23 additions & 23 deletions benefits/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
"POT-Creation-Date: 2026-02-09 16:30-0800\n"
"POT-Creation-Date: 2026-02-09 16:49-0800\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -428,28 +428,6 @@ msgid ""
"target=\"_blank\" rel=\"noopener noreferrer\">SBMTD Fares & Passes</a>."
msgstr ""

msgid "Your card information may not have been entered correctly."
msgstr ""

#, python-brace-format
msgid ""
"The number and last name must be entered exactly as they appear on your "
"{agency_card}. Please check your card and try again, or contact your transit "
"agency for help."
msgstr ""

msgid "Try again"
msgstr ""

msgid "CST Agency Card"
msgstr ""

msgid "MST Courtesy Card"
msgstr ""

msgid "SBMTD Reduced Fare Mobility ID card"
msgstr ""

msgid "Choose this benefit"
msgstr ""

Expand Down Expand Up @@ -795,6 +773,28 @@ msgstr ""
msgid "You selected a Veteran transit benefit."
msgstr ""

msgid "Your card information may not have been entered correctly."
msgstr ""

#, python-brace-format
msgid ""
"The number and last name must be entered exactly as they appear on your "
"{agency_card}. Please check your card and try again, or contact your transit "
"agency for help."
msgstr ""

msgid "Try again"
msgstr ""

msgid "CST Agency Card"
msgstr ""

msgid "MST Courtesy Card"
msgstr ""

msgid "SBMTD Reduced Fare Mobility ID card"
msgstr ""

msgid "Your eligibility is confirmed! You’re almost there."
msgstr ""

Expand Down
56 changes: 28 additions & 28 deletions benefits/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
"POT-Creation-Date: 2026-02-09 16:30-0800\n"
"POT-Creation-Date: 2026-02-09 16:49-0800\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -588,33 +588,6 @@ msgstr ""
"fares-passes/\" target=\"_blank\" rel=\"noopener noreferrer\">SBMTD Fares & "
"Passes</a>."

msgid "Your card information may not have been entered correctly."
msgstr ""
"Es posible que la información de su tarjeta no se haya ingresado "
"correctamente."

#, python-brace-format
msgid ""
"The number and last name must be entered exactly as they appear on your "
"{agency_card}. Please check your card and try again, or contact your transit "
"agency for help."
msgstr ""
"El número y el apellido deben ingresarse exactamente como aparecen en su "
"{agency_card}. Verifique su tarjeta e inténtelo de nuevo, o contacte a su "
"agencia de tránsito para obtener ayuda."

msgid "Try again"
msgstr "Inténtelo de nuevo"

msgid "CST Agency Card"
msgstr "tarjeta de agencia de CST"

msgid "MST Courtesy Card"
msgstr "tarjeta de cortesía de MST"

msgid "SBMTD Reduced Fare Mobility ID card"
msgstr "tarjeta Reduced Fare Mobility ID de SBMTD"

msgid "Choose this benefit"
msgstr "Elegir este beneficio"

Expand Down Expand Up @@ -1022,6 +995,33 @@ msgstr "Descripción de beneficios para veteranos"
msgid "You selected a Veteran transit benefit."
msgstr "Ha seleccionado un beneficio de tránsito para veteranos."

msgid "Your card information may not have been entered correctly."
msgstr ""
"Es posible que la información de su tarjeta no se haya ingresado "
"correctamente."

#, python-brace-format
msgid ""
"The number and last name must be entered exactly as they appear on your "
"{agency_card}. Please check your card and try again, or contact your transit "
"agency for help."
msgstr ""
"El número y el apellido deben ingresarse exactamente como aparecen en su "
"{agency_card}. Verifique su tarjeta e inténtelo de nuevo, o contacte a su "
"agencia de tránsito para obtener ayuda."

msgid "Try again"
msgstr "Inténtelo de nuevo"

msgid "CST Agency Card"
msgstr "tarjeta de agencia de CST"

msgid "MST Courtesy Card"
msgstr "tarjeta de cortesía de MST"

msgid "SBMTD Reduced Fare Mobility ID card"
msgstr "tarjeta Reduced Fare Mobility ID de SBMTD"

msgid "Your eligibility is confirmed! You’re almost there."
msgstr "¡Su elegibilidad está confirmada! Ya falta poco."

Expand Down
Empty file.
29 changes: 0 additions & 29 deletions tests/pytest/eligibility/context/test_flow.py

This file was deleted.

25 changes: 10 additions & 15 deletions tests/pytest/eligibility/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,31 +248,26 @@ def test_form_valid_verified(self, mocker, view, form_data, mocked_session_updat
@pytest.mark.django_db
class TestUnverifiedView:
@pytest.fixture
def view(self, app_request, mocked_eligibility_request_session):
def view(self, app_request, model_EnrollmentFlow):
v = views.UnverifiedView()
v.setup(app_request)

model_EnrollmentFlow.system_name = SystemName.AGENCY_CARD
v.flow = model_EnrollmentFlow
return v

def test_view(self, view):
assert view.template_name == "eligibility/unverified.html"

def test_get_context_data__dispatched(self, view, app_request, model_EnrollmentFlow):
view.dispatch(app_request)

ctx = view.get_context_data()

for key, value in model_EnrollmentFlow.eligibility_unverified_context.items():
assert ctx[key] == value
def test_get_context_data(self, view):
context = view.get_context_data()

def test_get_context_data__not_dispatched(self, view, model_EnrollmentFlow):
with pytest.raises(AttributeError, match="object has no attribute 'flow'"):
view.get_context_data()
assert "headline_text" in context
assert "body_text" in context
assert "button_text" in context

def test_get(self, mocker, view, app_request, mocked_analytics_module):
# spy on the call to get() but call dispatch() like a real request
spy = mocker.spy(view, "get")
response = view.dispatch(app_request)
response = view.get(app_request)

spy.assert_called_once()
assert response.status_code == 200
mocked_analytics_module.returned_fail.assert_called_once()
Loading