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

Veterans - Eligibility Verifier + Eligibility Type #1436

Merged
merged 17 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c6b480c
chore(migrations): reporting a potential bug
machikoyasuda Jun 21, 2023
c09fdd1
feat(data): add mst_veteran_type, mst_veteran_verifier + copy
machikoyasuda Jun 21, 2023
31b7cd9
chore(django): make messages
machikoyasuda Jun 21, 2023
92f0dbe
feat(terraform): add MST_VETERAN_VERIFIER_NAME to terraform
machikoyasuda Jun 21, 2023
c52d17b
feat(terraform): add MST_VETERAN_GROUP_ID
machikoyasuda Jun 21, 2023
25156ee
fix(django): make messages again; remove unnecessary copy
machikoyasuda Jun 21, 2023
1a43ac1
test(cypress): update radio button spec
machikoyasuda Jun 21, 2023
0ccd978
test(cypress): update invalid inputs to 3
machikoyasuda Jun 21, 2023
fba4f62
feat(core): add start_item_secondary_details to EligibilityVerifier
machikoyasuda Jun 21, 2023
6b21bdc
feat(media-list): add Secondary Details to Media List, use in Eligibi…
machikoyasuda Jun 21, 2023
0fd040d
feat(verifier): move Veterans verifier to the middle, so that the ord…
machikoyasuda Jun 21, 2023
9a8b171
fix(migration): secondary_details, not details
machikoyasuda Jun 21, 2023
251e28c
test(cypress): update selectCourtesyCard with proper radio button number
machikoyasuda Jun 21, 2023
22e49bf
fix(migrations): rename veteran verifier name description
machikoyasuda Jun 21, 2023
3fb3115
fix(eligibility-index): add VA.gov url to radio button, use format_ht…
machikoyasuda Jun 22, 2023
ed7d8a9
refactor(msgids): remove login_gov from msgid for unverified page
machikoyasuda Jun 22, 2023
58de64d
fix(copy): add the word Transit
machikoyasuda Jun 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion benefits/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2 on 2023-06-20 17:30
# Generated by Django 4.2 on 2023-06-22 18:44

from django.db import migrations, models
import django.db.models.deletion
Expand Down Expand Up @@ -50,6 +50,7 @@ class Migration(migrations.Migration):
("start_headline", models.TextField()),
("start_item_heading", models.TextField()),
("start_item_details", models.TextField()),
("start_item_secondary_details", models.TextField()),
("start_help_anchor", models.TextField()),
("form_title", models.TextField(null=True)),
("form_headline", models.TextField(null=True)),
Expand Down
35 changes: 30 additions & 5 deletions benefits/core/migrations/0002_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def load_data(app, *args, **kwargs):
mst_senior_type = EligibilityType.objects.create(
name="senior", label="Senior Discount (MST)", group_id=os.environ.get("MST_SENIOR_GROUP_ID", "group1")
)
mst_veteran_type = EligibilityType.objects.create(
name="veteran",
label="Veteran Discount (MST)",
group_id=os.environ.get("MST_VETERAN_GROUP_ID", "group3"),
)
thekaveman marked this conversation as resolved.
Show resolved Hide resolved
mst_courtesy_card_type = EligibilityType.objects.create(
name="courtesy_card",
label="Courtesy Card Discount (MST)",
Expand Down Expand Up @@ -145,8 +150,8 @@ def load_data(app, *args, **kwargs):
start_item_heading=_("eligibility.pages.start.login_gov.start_item.heading"),
start_item_details=_("eligibility.pages.start.login_gov.start_item.details"),
start_help_anchor="login-gov",
unverified_title=_("eligibility.pages.unverified.login_gov.title"),
unverified_blurb=_("eligibility.pages.unverified.login_gov.p[0]"),
unverified_title=_("eligibility.pages.unverified.title"),
unverified_blurb=_("eligibility.pages.unverified.p[0]"),
eligibility_confirmed_item_heading=_("enrollment.pages.index.login_gov.eligibility_confirmed_item.heading"),
eligibility_confirmed_item_details=_(
"enrollment.pages.index.login_gov.eligibility_confirmed_item.details%(transit_agency_short_name)s"
Expand All @@ -156,6 +161,26 @@ def load_data(app, *args, **kwargs):
enrollment_success_expiry_item_details=None,
)

mst_veteran_verifier = EligibilityVerifier.objects.create(
name=os.environ.get("MST_VETERAN_VERIFIER_NAME", "VA.gov - Veteran (MST)"),
eligibility_type=mst_veteran_type,
thekaveman marked this conversation as resolved.
Show resolved Hide resolved
auth_provider=auth_provider,
selection_label=_("eligibility.pages.index.veteran.label"),
selection_label_description=_("eligibility.pages.index.veteran.description"),
start_title=_("eligibility.pages.start.veteran.title"),
start_headline=_("eligibility.pages.start.veteran.headline"),
start_item_heading=_("eligibility.pages.start.veteran.start_item.heading"),
start_item_details=_("eligibility.pages.start.veteran.start_item.details"),
start_item_secondary_details=_("eligibility.pages.start.veteran.start_item.secondary_details"),
unverified_title=_("eligibility.pages.unverified.title"),
unverified_blurb=_("eligibility.pages.unverified.p[0]"),
enrollment_success_confirm_item_details=_(
"enrollment.pages.index.login_gov.eligibility_confirmed_item.details%(transit_agency_short_name)s"
),
enrollment_success_expiry_item_heading=None,
enrollment_success_expiry_item_details=None,
)

mst_courtesy_card_verifier = EligibilityVerifier.objects.create(
name=os.environ.get("COURTESY_CARD_VERIFIER", "Eligibility Server Verifier"),
api_url=os.environ.get("COURTESY_CARD_VERIFIER_API_URL", "http://server:8000/verify"),
Expand Down Expand Up @@ -207,8 +232,8 @@ def load_data(app, *args, **kwargs):
start_item_heading=_("eligibility.pages.start.login_gov.start_item.heading"),
start_item_details=_("eligibility.pages.start.login_gov.start_item.details"),
start_help_anchor="login-gov",
unverified_title=_("eligibility.pages.unverified.login_gov.title"),
unverified_blurb=_("eligibility.pages.unverified.login_gov.p[0]"),
unverified_title=_("eligibility.pages.unverified.title"),
unverified_blurb=_("eligibility.pages.unverified.p[0]"),
eligibility_confirmed_item_heading=_("enrollment.pages.index.login_gov.eligibility_confirmed_item.heading"),
eligibility_confirmed_item_details=_(
"enrollment.pages.index.login_gov.eligibility_confirmed_item.details%(transit_agency_short_name)s"
Expand Down Expand Up @@ -277,7 +302,7 @@ def load_data(app, *args, **kwargs):
eligibility_index_intro=_("eligibility.pages.index.p[0].mst"),
)
mst_agency.eligibility_types.set([mst_senior_type, mst_courtesy_card_type])
mst_agency.eligibility_verifiers.set([mst_oauth_claims_verifier, mst_courtesy_card_verifier])
mst_agency.eligibility_verifiers.set([mst_oauth_claims_verifier, mst_veteran_verifier, mst_courtesy_card_verifier])

sacrt_agency = TransitAgency.objects.create(
slug="sacrt",
Expand Down
1 change: 1 addition & 0 deletions benefits/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class EligibilityVerifier(models.Model):
start_headline = models.TextField()
start_item_heading = models.TextField()
start_item_details = models.TextField()
start_item_secondary_details = models.TextField()
start_help_anchor = models.TextField()
form_title = models.TextField(null=True)
form_headline = models.TextField(null=True)
Expand Down
1 change: 1 addition & 0 deletions benefits/core/templates/core/includes/media-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{% endif %}
</div>
{% endif %}
{% if item.secondary_details %}<p class="pt-1">{{ item.secondary_details }}</p>{% endif %}
</div>
</li>
{% endfor %}
Expand Down
4 changes: 3 additions & 1 deletion benefits/core/viewmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ class MediaItem:
Represents a media item in a list of items:
* icon: core.viewmodels.Icon
* details: str, str[]
* secondary_details: str
* heading: str
* bullets: str, str[]
"""

def __init__(self, icon: Icon, details, heading=None, bullets=None):
def __init__(self, icon: Icon, details, secondary_details=None, heading=None, bullets=None):
self.icon = icon
if isinstance(details, str):
self.details = [details]
Expand All @@ -120,6 +121,7 @@ def __init__(self, icon: Icon, details, heading=None, bullets=None):
else:
self.details = [str(details)]
self.heading = heading
self.secondary_details = secondary_details
if isinstance(bullets, str):
self.bullets = [bullets]
elif isinstance(bullets, list):
Expand Down
3 changes: 2 additions & 1 deletion benefits/eligibility/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

from django import forms
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _

from benefits.core import models, recaptcha, widgets
Expand All @@ -30,7 +31,7 @@ def __init__(self, agency: models.TransitAgency, *args, **kwargs):
self.classes = "offset-lg-1 col-lg-9"
self.fields["verifier"].choices = [(v.id, _(v.selection_label)) for v in verifiers]
self.fields["verifier"].widget.choice_descriptions = {
v.id: _(v.selection_label_description) for v in verifiers if v.selection_label_description
v.id: format_html(_(v.selection_label_description)) for v in verifiers if v.selection_label_description
}

def clean(self):
Expand Down
1 change: 1 addition & 0 deletions benefits/eligibility/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def start(request):
icon=viewmodels.Icon("idcardcheck", pgettext("image alt text", "core.icons.idcardcheck")),
heading=_(verifier.start_item_heading),
details=_(verifier.start_item_details),
secondary_details=_(verifier.start_item_secondary_details),
angela-tran marked this conversation as resolved.
Show resolved Hide resolved
)

if verifier.is_auth_required:
Expand Down
39 changes: 35 additions & 4 deletions benefits/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#, fuzzy
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
"POT-Creation-Date: 2023-01-26 16:08+0000\n"
"Report-Msgid-Bugs-To: \n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we lose our Issues link here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the helper bin/makemessages.sh was not run, it is supposed to put this line back.

"POT-Creation-Date: 2023-06-21 23:17+0000\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -44,10 +44,10 @@ msgstr ""
"will be able to create one. You will also need to verify your identity, "
"which will require these items:"

msgid "eligibility.pages.unverified.login_gov.title"
msgid "eligibility.pages.unverified.title"
msgstr "Eligibility Error"

msgid "eligibility.pages.unverified.login_gov.p[0]"
msgid "eligibility.pages.unverified.p[0]"
msgstr ""
"That’s okay! You may still be eligible for our program. Please reach out to "
"your local transit provider for assistance."
Expand All @@ -71,6 +71,36 @@ msgstr ""
"You will need to reapply if you choose to change the bank card you use to "
"pay for transit service."

msgid "eligibility.pages.index.veteran.label"
msgstr "US Veteran"

msgid "eligibility.pages.index.veteran.description"
msgstr ""
"This option is for people who have served in the active military, naval, or "
"air service, and who were discharged or released therefrom under conditions "
"other than dishonorable. You will need to <a href='https://www.va.gov/"
"resources/verifying-your-identity-on-vagov/' target=\"_blank\" rel="
"\"noopener noreferrer\">verify your identity through VA.gov</a>"

msgid "eligibility.pages.start.veteran.title"
msgstr "Veteran benefit information"

msgid "eligibility.pages.start.veteran.headline"
msgstr "You selected a Veteran transit benefit."

msgid "eligibility.pages.start.veteran.start_item.heading"
msgstr "Access to your preferred VA related account"

msgid "eligibility.pages.start.veteran.start_item.details"
msgstr ""
"You will need to sign into VA.gov in order to verify your identity and your "
"veteran status. VA.gov uses the following services:"

msgid "eligibility.pages.start.veteran.start_item.secondary_details"
msgstr ""
"If you do not have an account with any of these services, you will need to "
"create one. We recommend using Login.gov."

msgid "eligibility.pages.index.mst_cc.label"
msgstr "I have an MST Courtesy Card"

Expand Down Expand Up @@ -328,6 +358,7 @@ msgstr "GitHub"
msgid "core.pages.index.agency_selector.headline"
msgstr "Please choose your transit provider:"

#, python-format
msgid "core.pages.index.agency_selector%(agency_short_name)s"
msgstr "%(agency_short_name)s logo"

Expand Down
39 changes: 35 additions & 4 deletions benefits/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#, fuzzy
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
"POT-Creation-Date: 2023-01-26 16:08+0000\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-21 23:17+0000\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -44,10 +44,10 @@ msgstr ""
"no tiene una cuenta, podrá crear una. También deberá verificar su identidad, "
"lo que requerirá estos artículos:"

msgid "eligibility.pages.unverified.login_gov.title"
msgid "eligibility.pages.unverified.title"
msgstr "Error de elegibilidad"

msgid "eligibility.pages.unverified.login_gov.p[0]"
msgid "eligibility.pages.unverified.p[0]"
msgstr ""
"¡Esta bien! Aún puede ser elegible para nuestro programa. Comuníquese con su "
"proveedor de tránsito local para obtener asistencia."
Expand All @@ -71,6 +71,36 @@ msgstr ""
"Deberá volver a presenter la solicitud si elige cambiar la tarjeta bancaria "
"que utiliza para pagar el servicio de transito."

msgid "eligibility.pages.index.veteran.label"
msgstr "TODO: US Veteran"

msgid "eligibility.pages.index.veteran.description"
msgstr ""
"TODO: This option is for people who have served in the active military, "
"naval, or air service, and who were discharged or released therefrom under "
"conditions other than dishonorable. You will need to <a href='https://www.va."
"gov/resources/verifying-your-identity-on-vagov/' target=\"_blank\" rel="
"\"noopener noreferrer\">verify your identity through VA.gov</a>"

msgid "eligibility.pages.start.veteran.title"
msgstr "TODO: Veteran benefit information"

msgid "eligibility.pages.start.veteran.headline"
msgstr "TODO: You selected a Veteran transit benefit."

msgid "eligibility.pages.start.veteran.start_item.heading"
msgstr "TODO: Access to your preferred VA related account"

msgid "eligibility.pages.start.veteran.start_item.details"
msgstr ""
"TODO: You will need to sign into VA.gov in order to verify your identity and "
"your veteran status. VA.gov uses the following services:"

msgid "eligibility.pages.start.veteran.start_item.secondary_details"
msgstr ""
"TODO: If you do not have an account with any of these services, you will "
"need to create one. We recommend using Login.gov."

msgid "eligibility.pages.index.mst_cc.label"
msgstr "Tengo una Tarjeta de Cortesía de MST"

Expand Down Expand Up @@ -343,6 +373,7 @@ msgstr "GitHub"
msgid "core.pages.index.agency_selector.headline"
msgstr "Por favor, elija su proveedor de transporte:"

#, python-format
msgid "core.pages.index.agency_selector%(agency_short_name)s"
msgstr "%(agency_short_name)s logo"

Expand Down
2 changes: 2 additions & 0 deletions terraform/app_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ resource "azurerm_linux_web_app" "main" {

# Environment variables for data migration
"MST_SENIOR_GROUP_ID" = "${local.secret_prefix}mst-senior-group-id)",
"MST_VETERAN_GROUP_ID" = "${local.secret_prefix}mst-veteran-group-id)",
"MST_COURTESY_CARD_GROUP_ID" = "${local.secret_prefix}mst-courtesy-card-group-id)"
"SACRT_SENIOR_GROUP_ID" = "${local.secret_prefix}sacrt-senior-group-id)"
"CLIENT_PRIVATE_KEY" = "${local.secret_prefix}client-private-key)"
Expand All @@ -96,6 +97,7 @@ resource "azurerm_linux_web_app" "main" {
"AUTH_PROVIDER_SCOPE" = "${local.secret_prefix}auth-provider-scope)"
"AUTH_PROVIDER_CLAIM" = "${local.secret_prefix}auth-provider-claim)"
"MST_OAUTH_VERIFIER_NAME" = "${local.secret_prefix}mst-oauth-verifier-name)"
"MST_VETERAN_VERIFIER_NAME" = "${local.secret_prefix}mst-veteran-verifier-name)"
thekaveman marked this conversation as resolved.
Show resolved Hide resolved
"COURTESY_CARD_VERIFIER" = "${local.secret_prefix}courtesy-card-verifier)"
"COURTESY_CARD_VERIFIER_API_URL" = "${local.secret_prefix}courtesy-card-verifier-api-url)"
"COURTESY_CARD_VERIFIER_API_AUTH_HEADER" = "${local.secret_prefix}courtesy-card-verifier-api-auth-header)"
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/plugins/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const selectCourtesyCard = () => {
cy.location("pathname").should("eq", `/eligibility/${agency.slug}`);

// TODO find a more robust way to do this
thekaveman marked this conversation as resolved.
Show resolved Hide resolved
cy.get('#form-verifier-selection [type="radio"]').check("2");
cy.get('#form-verifier-selection [type="radio"]').check("3");
cy.get("#form-verifier-selection button[type='submit']").click();
cy.contains("Continue").click();
};
8 changes: 4 additions & 4 deletions tests/cypress/specs/benefit-select.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ describe("Benefit selection", () => {
helpers.selectAgency();
});

it("User sees two radio buttons", () => {
cy.get("input:radio").should("have.length", 2);
it("User sees 3 radio buttons", () => {
cy.get("input:radio").should("have.length", 3);
cy.contains("Courtesy Card");
cy.contains("65 years");
});

it("User must select a radio button, or else see a validation message", () => {
cy.get("input:radio").should("have.length", 2);
cy.get("input:radio").should("have.length", 3);
cy.get("input:radio:checked").should("have.length", 0);
cy.get("#form-verifier-selection").submit();

cy.url().should("include", verifier_selection_url);
cy.get("input:radio:checked").should("have.length", 0);
cy.get("input:invalid").should("have.length", 2);
cy.get("input:invalid").should("have.length", 3);
cy.get("input:radio")
.first()
.invoke("prop", "validationMessage")
Expand Down
1 change: 1 addition & 0 deletions tests/pytest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def model_EligibilityVerifier(model_PemData, model_EligibilityType):
start_headline="Start",
start_item_heading="Start Item",
start_item_details="Start Item Description",
start_item_secondary_details="Start Item Details Secondary",
form_title="Form",
form_headline="Form",
form_blurb="Form Blurb",
Expand Down