diff --git a/benefits/eligibility/forms.py b/benefits/eligibility/forms.py index d66ee506b..d239f213b 100644 --- a/benefits/eligibility/forms.py +++ b/benefits/eligibility/forms.py @@ -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.""" diff --git a/benefits/locale/en/LC_MESSAGES/django.po b/benefits/locale/en/LC_MESSAGES/django.po index 9a6d7d1cf..c07625ed3 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-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" @@ -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 "" @@ -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." @@ -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." diff --git a/benefits/locale/es/LC_MESSAGES/django.po b/benefits/locale/es/LC_MESSAGES/django.po index 683f20c62..3f01929cb 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-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" @@ -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" @@ -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." @@ -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." @@ -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 " diff --git a/tests/pytest/eligibility/test_forms.py b/tests/pytest/eligibility/test_forms.py index 42799ebac..1460bc9e9 100644 --- a/tests/pytest/eligibility/test_forms.py +++ b/tests/pytest/eligibility/test_forms.py @@ -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():