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

Fix: CST templates #2205

Merged
merged 3 commits into from
Jul 10, 2024
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
29 changes: 29 additions & 0 deletions benefits/eligibility/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,35 @@ def clean(self):
raise forms.ValidationError("reCAPTCHA failed")


class CSTAgencyCard(EligibilityVerificationForm):
"""EligibilityVerification form for the CST Agency Card."""

def __init__(self, *args, **kwargs):
super().__init__(
title=_("Agency card information"),
headline=_("Let’s find the record of your transit benefit."),
blurb=_(
"We use the information on your CST Agency Card to find the record of your transit benefit in our system."
),
name_label=_("Last Name"),
name_placeholder="Hernandez-Demarcos",
name_help_text=_(
"Please enter your last name the same way it is printed on your card, including capital letters and hyphens."
),
sub_label=_("Agency Card number"),
sub_help_text=_("This is a 5-digit number on the front and back of your card."),
sub_placeholder="12345",
name_max_length=255,
sub_input_mode="numeric",
sub_max_length=5,
sub_pattern=r"\d{5}",
sub_custom_validity=_("Please enter a 5-digit number."),
name_custom_validity=_("Please enter your last name."),
*args,
**kwargs,
)


class MSTCourtesyCard(EligibilityVerificationForm):
"""EligibilityVerification form for the MST Courtesy Card."""

Expand Down
14 changes: 11 additions & 3 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: 2024-07-03 13:26-0700\n"
"POT-Creation-Date: 2024-07-09 10:45-0700\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -333,7 +333,7 @@ msgid "Let’s find the record of your transit benefit."
msgstr ""

msgid ""
"We use the information on your MST Courtesy Card to find the record of your "
"We use the information on your CST Agency Card to find the record of your "
"transit benefit in our system."
msgstr ""

Expand All @@ -345,7 +345,7 @@ msgid ""
"including capital letters and hyphens."
msgstr ""

msgid "Courtesy Card number"
msgid "Agency Card number"
msgstr ""

msgid "This is a 5-digit number on the front and back of your card."
Expand All @@ -357,6 +357,14 @@ msgstr ""
msgid "Please enter your last name."
msgstr ""

msgid ""
"We use the information on your MST Courtesy Card to find the record of your "
"transit benefit in our system."
msgstr ""

msgid "Courtesy Card number"
msgstr ""

msgid ""
"We use the information on your SBMTD Reduced Fare Mobility ID card to find "
"the record of your transit benefit in our system."
Expand Down
31 changes: 21 additions & 10 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: 2024-07-03 13:26-0700\n"
"POT-Creation-Date: 2024-07-09 10:45-0700\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -444,11 +444,11 @@ msgid "Let’s find the record of your transit benefit."
msgstr "Veamos si podemos confirmar su elegibilidad."

msgid ""
"We use the information on your MST Courtesy Card to find the record of your "
"We use the information on your CST Agency Card to find the record of your "
"transit benefit in our system."
msgstr ""
"Usamos la información de su tarjeta de cortesía de MST para confirmar su "
"elegibilidad en nuestro sistema."
"Utilizamos la información de su Tarjeta de agencia CST para encontrar el "
"registro de su beneficio de tránsito en nuestro sistema."

msgid "Last Name"
msgstr "Apellido"
Expand All @@ -460,8 +460,8 @@ msgstr ""
"Ingrese su apellido de la misma manera que está impreso en su tarjeta, "
"incluyendo mayúsculas y guiones."

msgid "Courtesy Card number"
msgstr "Número de tarjeta de cortesía de MST"
msgid "Agency Card number"
msgstr "Número de tarjeta de agencia de CST"

msgid "This is a 5-digit number on the front and back of your card."
msgstr "Este es un número de 5 dígitos en el anverso y reverso de su tarjeta."
Expand All @@ -472,6 +472,16 @@ msgstr "Ingrese un número de 5 dígitos."
msgid "Please enter your last name."
msgstr "Ingrese su apellido."

msgid ""
"We use the information on your MST Courtesy Card to find the record of your "
"transit benefit in our system."
msgstr ""
"Usamos la información de su tarjeta de cortesía de MST para confirmar su "
"elegibilidad en nuestro sistema."

msgid "Courtesy Card number"
msgstr "Número de tarjeta de cortesía de MST"

msgid ""
"We use the information on your SBMTD Reduced Fare Mobility ID card to find "
"the record of your transit benefit in our system."
Expand Down Expand Up @@ -880,15 +890,16 @@ msgid ""
"fare. You will need to re-enroll if you choose to change the card you use to "
"pay for transit service."
msgstr ""
"Su tarjeta sin contacto ahora está inscrita en el beneficio de tránsito de "
"la tarjeta de agencia de CST. Cuando suba a un autobús de CST, toque el "
"lector con esta tarjeta y se le cobrará una tarifa reducida. Deberá volver a "
"Su tarjeta sin contacto ahora está inscrita en un beneficio de tránsito de "
"Tarjeta de agencia de CST. Cuando suba a un autobús de CST, toque el lector "
"con esta tarjeta y se le cobrará una tarifa reducida. Deberá volver a "
"inscribirse si elige cambiar la tarjeta que usa para pagar el servicio de "
"tránsito."

msgid ""
"You were not charged anything today. Thank you for using Cal-ITP Benefits!"
msgstr "No se le cobró nada hoy. ¡Gracias por usar Cal-ITP Benefits!"
msgstr ""
"No se le cobrará nada hoy. ¡Gracias por utilizar los beneficios de Cal-ITP!"

msgid ""
"You were not charged anything today. When boarding a CST bus, tap your "
Expand Down
20 changes: 19 additions & 1 deletion tests/pytest/eligibility/test_forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
from benefits.eligibility.forms import MSTCourtesyCard, SBMTDMobilityPass
from benefits.eligibility.forms import CSTAgencyCard, MSTCourtesyCard, SBMTDMobilityPass


def test_CSTAgencyCard():
form = CSTAgencyCard(data={"sub": "12345", "name": "Gonzalez"})

assert form.is_valid()

sub_attrs = form.fields["sub"].widget.attrs
assert sub_attrs["pattern"] == r"\d{5}"
assert sub_attrs["inputmode"] == "numeric"
assert sub_attrs["maxlength"] == 5
assert sub_attrs["data-custom-validity"] == "Please enter a 5-digit number."

name_attrs = form.fields["name"].widget.attrs
assert name_attrs["maxlength"] == 255
assert name_attrs["data-custom-validity"] == "Please enter your last name."

assert form.use_custom_validity


def test_MSTCourtesyCard():
Expand Down
Loading