Skip to content

Commit

Permalink
Feat: Add SBTMD Mobility Pass configuration (#1771)
Browse files Browse the repository at this point in the history
  • Loading branch information
machikoyasuda authored Nov 8, 2023
2 parents c99b74d + e209a18 commit c5f1972
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 19 deletions.
40 changes: 35 additions & 5 deletions benefits/core/migrations/0002_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,25 @@ def load_data(app, *args, **kwargs):
sbmtd_senior_type = EligibilityType.objects.create(
name="senior", label="Senior Discount (SBMTD)", group_id=os.environ.get("SBMTD_SENIOR_GROUP_ID", "group4")
)
sbmtd_mobility_pass_type = EligibilityType.objects.create(
name="mobility_pass",
label="Mobility Pass Discount (SBMTD)",
group_id=os.environ.get("SBMTD_MOBILITY_PASS_GROUP_ID", "group5"),
)

PemData = app.get_model("core", "PemData")

server_public_key = PemData.objects.create(
mst_server_public_key = PemData.objects.create(
label="Eligibility server public key",
remote_url=os.environ.get(
"SERVER_PUBLIC_KEY_URL", "https://raw.githubusercontent.com/cal-itp/eligibility-server/dev/keys/server.pub"
"MST_SERVER_PUBLIC_KEY_URL", "https://raw.githubusercontent.com/cal-itp/eligibility-server/dev/keys/server.pub"
),
)

sbmtd_server_public_key = PemData.objects.create(
label="Eligibility server public key",
remote_url=os.environ.get(
"SBMTD_SERVER_PUBLIC_KEY_URL", "https://raw.githubusercontent.com/cal-itp/eligibility-server/dev/keys/server.pub"
),
)

Expand Down Expand Up @@ -192,7 +204,7 @@ def load_data(app, *args, **kwargs):
api_auth_header=os.environ.get("COURTESY_CARD_VERIFIER_API_AUTH_HEADER", "X-Server-API-Key"),
api_auth_key=os.environ.get("COURTESY_CARD_VERIFIER_API_AUTH_KEY", "server-auth-token"),
eligibility_type=mst_courtesy_card_type,
public_key=server_public_key,
public_key=mst_server_public_key,
jwe_cek_enc=os.environ.get("COURTESY_CARD_VERIFIER_JWE_CEK_ENC", "A256CBC-HS512"),
jwe_encryption_alg=os.environ.get("COURTESY_CARD_VERIFIER_JWE_ENCRYPTION_ALG", "RSA-OAEP"),
jws_signing_alg=os.environ.get("COURTESY_CARD_VERIFIER_JWS_SIGNING_ALG", "RS256"),
Expand Down Expand Up @@ -220,6 +232,23 @@ def load_data(app, *args, **kwargs):
start_template="eligibility/start--senior.html",
)

sbmtd_mobility_pass_verifier = EligibilityVerifier.objects.create(
name=os.environ.get("MOBILITY_PASS_VERIFIER_NAME", "Eligibility Server Verifier"),
active=os.environ.get("MOBILITY_PASS_VERIFIER_ACTIVE", "True").lower() == "true",
api_url=os.environ.get("MOBILITY_PASS_VERIFIER_API_URL", "http://server:8000/verify"),
api_auth_header=os.environ.get("MOBILITY_PASS_VERIFIER_API_AUTH_HEADER", "X-Server-API-Key"),
api_auth_key=os.environ.get("MOBILITY_PASS_VERIFIER_API_AUTH_KEY", "server-auth-token"),
eligibility_type=sbmtd_mobility_pass_type,
public_key=sbmtd_server_public_key,
jwe_cek_enc=os.environ.get("MOBILITY_PASS_VERIFIER_JWE_CEK_ENC", "A256CBC-HS512"),
jwe_encryption_alg=os.environ.get("MOBILITY_PASS_VERIFIER_JWE_ENCRYPTION_ALG", "RSA-OAEP"),
jws_signing_alg=os.environ.get("MOBILITY_PASS_VERIFIER_JWS_SIGNING_ALG", "RS256"),
auth_provider=None,
selection_label_template="eligibility/includes/selection-label--sbmtd-mobility-pass.html",
start_template="eligibility/start--sbmtd-mobility-pass.html",
form_class="benefits.eligibility.forms.SBMTDMobilityPass",
)

PaymentProcessor = app.get_model("core", "PaymentProcessor")

mst_payment_processor = PaymentProcessor.objects.create(
Expand Down Expand Up @@ -337,9 +366,10 @@ def load_data(app, *args, **kwargs):
index_template="core/index--sbmtd.html",
eligibility_index_template="eligibility/index--sbmtd.html",
enrollment_success_template="enrollment/success--sbmtd.html",
help_template="core/includes/help--sbmtd.html",
)
sbmtd_agency.eligibility_types.set([sbmtd_senior_type])
sbmtd_agency.eligibility_verifiers.set([sbmtd_senior_verifier])
sbmtd_agency.eligibility_types.set([sbmtd_senior_type, sbmtd_mobility_pass_type])
sbmtd_agency.eligibility_verifiers.set([sbmtd_senior_verifier, sbmtd_mobility_pass_verifier])


class Migration(migrations.Migration):
Expand Down
8 changes: 8 additions & 0 deletions benefits/core/templates/core/includes/help--sbmtd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% load i18n %}

<h2 class="h2-sm pt-4 pt-lg-8" id="mst-courtesy-card">{% translate "What is a Mobility Pass?" %}</h2>
<p class="pt-2 pt-lg-4">
{% blocktranslate trimmed %}
The Santa Barbara Metropolitan Transit District issues Mobility Pass cards to eligible riders. This transit benefit may need to be renewed in the future based on the expiration date of the Mobility Pass. Learn more at the <a href="https://sbmtd.gov/fares-passes/" target="_blank" rel="noopener noreferrer">SBMTD Fares & Passes</a>.
{% endblocktranslate %}
</p>
23 changes: 23 additions & 0 deletions benefits/eligibility/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,26 @@ def __init__(self, *args, **kwargs):
*args,
**kwargs,
)


class SBMTDMobilityPass(EligibilityVerificationForm):
"""EligibilityVerification form for the SBMTD Mobility Pass."""

def __init__(self, *args, **kwargs):
super().__init__(
title=_("Agency card information"),
headline=_("Let’s see if we can confirm your eligibility."),
blurb=_("Please input your Mobility Pass number and last name below to confirm your eligibility."),
name_label=_("Last name (as it appears on Mobility Pass)"),
name_placeholder="Garcia",
name_help_text=_("We use this to help confirm your Mobility Pass."),
sub_label=_("SBMTD Mobility Pass number"),
sub_help_text=_("This is a 4-digit number on the front and back of your card."),
sub_placeholder="1234",
name_max_length=255,
sub_input_mode="numeric",
sub_max_length=4,
sub_pattern=r"\d{4}",
*args,
**kwargs,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "eligibility/includes/media-item--idcardcheck.html" %}

{% load i18n %}

{% block heading %}
{% translate "Your current Mobility Pass number" %}
{% endblock heading %}

{% block body %}
<div class="media-body--details">
<p>
{% translate "You do not need to have your physical card, but you will need your four-digit Mobility Pass number on the back of the card." %}
</p>
</div>
{% endblock body %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "eligibility/includes/selection-label.html" %}
{% load i18n %}

{% block label %}
{% translate "SBMTD Mobility Pass" %}
{% endblock label %}

{% block description %}
{% translate "This option is for people who have a current SBMTD Mobility Pass." %}
{% endblock description %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends "eligibility/start.html" %}
{% load i18n %}

{% block page-title %}
{% translate "Agency card overview" %}
{% endblock page-title %}

{% block headline %}
<div class="col-lg-8">
<h1>{% translate "You selected a Mobility Pass transit benefit." %}</h1>
</div>
{% endblock headline %}

{% block media-item %}
{% include "eligibility/includes/media-item--idcardcheck--start--sbmtd-mobility-pass.html" %}
{% endblock media-item %}

{% block call-to-action %}
<div class="row d-flex justify-content-lg-end">
<div class="col-lg-3 offset-2 offset-sm-2 offset-lg-0 col-sm-8 col-8">
{% url "eligibility:confirm" as button_url %}
<a href="{{ button_url }}" class="btn btn-lg btn-primary" role="button">{% translate "Continue" %}</a>
</div>
</div>
{% endblock call-to-action %}
55 changes: 50 additions & 5 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: 2023-09-11 17:23+0000\n"
"POT-Creation-Date: 2023-11-01 23:33+0000\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -194,6 +194,17 @@ msgid ""
"target=\"_blank\" rel=\"noopener noreferrer\">MST Riders Guide</a>."
msgstr ""

msgid "What is a Mobility Pass?"
msgstr ""

msgid ""
"The Santa Barbara Metropolitan Transit District issues Mobility Pass cards "
"to eligible riders. This transit benefit may need to be renewed in the "
"future based on the expiration date of the Mobility Pass. Learn more at the "
"<a href=\"https://sbmtd.gov/fares-passes/\" target=\"_blank\" rel=\"noopener "
"noreferrer\">SBMTD Fares & Passes</a>."
msgstr ""

msgid "Sign out of Login.gov"
msgstr ""

Expand Down Expand Up @@ -291,6 +302,23 @@ msgstr ""
msgid "This is a 5-digit number on the front and back of your card."
msgstr ""

msgid ""
"Please input your Mobility Pass number and last name below to confirm your "
"eligibility."
msgstr ""

msgid "Last name (as it appears on Mobility Pass)"
msgstr ""

msgid "We use this to help confirm your Mobility Pass."
msgstr ""

msgid "SBMTD Mobility Pass number"
msgstr ""

msgid "This is a 4-digit number on the front and back of your card."
msgstr ""

msgid "Your contactless card details"
msgstr ""

Expand All @@ -309,6 +337,14 @@ msgid ""
"number. The number starts with a number sign (#) followed by five digits."
msgstr ""

msgid "Your current Mobility Pass number"
msgstr ""

msgid ""
"You do not need to have your physical card, but you will need your four-"
"digit Mobility Pass number on the back of the card."
msgstr ""

msgid "A Login.gov account with identity verification"
msgstr ""

Expand All @@ -335,21 +371,21 @@ msgstr ""
msgid "Go back"
msgstr ""

msgid "Verify your identity with "
msgid "Learn more about"
msgstr ""

msgctxt "image alt text"
msgid "Login.gov"
msgstr ""

msgid "Verify your identity with "
msgstr ""

msgid ""
"We use Login.gov to verify your identity to make sure you are eligible for "
"the transit benefit you selected."
msgstr ""

msgid "Learn more about"
msgstr ""

msgid "MST Courtesy Card"
msgstr ""

Expand All @@ -358,6 +394,12 @@ msgid ""
"eligibility card."
msgstr ""

msgid "SBMTD Mobility Pass"
msgstr ""

msgid "This option is for people who have a current SBMTD Mobility Pass."
msgstr ""

msgid "Older Adult"
msgstr ""

Expand Down Expand Up @@ -406,6 +448,9 @@ msgstr ""
msgid "Continue"
msgstr ""

msgid "You selected a Mobility Pass transit benefit."
msgstr ""

msgid "Older Adult benefit overview"
msgstr ""

Expand Down
Loading

0 comments on commit c5f1972

Please sign in to comment.