Skip to content

Commit

Permalink
Feat: configure SBMTD senior flow (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran authored Aug 15, 2023
2 parents 8e99c02 + f2043d4 commit b251c74
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 14 deletions.
71 changes: 67 additions & 4 deletions benefits/core/migrations/0002_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def load_data(app, *args, **kwargs):
sacrt_senior_type = EligibilityType.objects.create(
name="senior", label="Senior Discount (SacRT)", group_id=os.environ.get("SACRT_SENIOR_GROUP_ID", "group3")
)
sbmtd_senior_type = EligibilityType.objects.create(
name="senior", label="Senior Discount (SBMTD)", group_id=os.environ.get("SBMTD_SENIOR_GROUP_ID", "group4")
)

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

Expand Down Expand Up @@ -124,6 +127,21 @@ def load_data(app, *args, **kwargs):
label="SacRT payment processor client certificate root CA",
)

sbmtd_payment_processor_client_cert = PemData.objects.create(
text=os.environ.get("SBMTD_PAYMENT_PROCESSOR_CLIENT_CERT", dummy_cert_text),
label="SBMTD payment processor client certificate",
)

sbmtd_payment_processor_client_cert_private_key = PemData.objects.create(
text=os.environ.get("SBMTD_PAYMENT_PROCESSOR_CLIENT_CERT_PRIVATE_KEY", client_private_key.text),
label="SBMTD payment processor client certificate private key",
)

sbmtd_payment_processor_client_cert_root_ca = PemData.objects.create(
text=os.environ.get("SBMTD_PAYMENT_PROCESSOR_CLIENT_CERT_ROOT_CA", dummy_cert_text),
label="SBMTD payment processor client certificate root CA",
)

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

senior_auth_provider = AuthProvider.objects.create(
Expand All @@ -148,7 +166,7 @@ def load_data(app, *args, **kwargs):

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

mst_oauth_claims_verifier = EligibilityVerifier.objects.create(
mst_senior_verifier = EligibilityVerifier.objects.create(
name=os.environ.get("MST_OAUTH_VERIFIER_NAME", "OAuth claims via Login.gov (MST)"),
eligibility_type=mst_senior_type,
auth_provider=senior_auth_provider,
Expand Down Expand Up @@ -192,14 +210,22 @@ def load_data(app, *args, **kwargs):
form_name_max_length=255,
)

sacrt_oauth_claims_verifier = EligibilityVerifier.objects.create(
sacrt_senior_verifier = EligibilityVerifier.objects.create(
name=os.environ.get("SACRT_OAUTH_VERIFIER_NAME", "OAuth claims via Login.gov (SacRT)"),
eligibility_type=sacrt_senior_type,
auth_provider=senior_auth_provider,
selection_label_template="eligibility/includes/selection-label--senior.html",
start_template="eligibility/start--senior.html",
)

sbmtd_senior_verifier = EligibilityVerifier.objects.create(
name=os.environ.get("SBMTD_OAUTH_VERIFIER_NAME", "OAuth claims via Login.gov (SBMTD)"),
eligibility_type=sbmtd_senior_type,
auth_provider=senior_auth_provider,
selection_label_template="eligibility/includes/selection-label--senior.html",
start_template="eligibility/start--senior.html",
)

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

mst_payment_processor = PaymentProcessor.objects.create(
Expand Down Expand Up @@ -236,6 +262,23 @@ def load_data(app, *args, **kwargs):
group_endpoint="group",
)

sbmtd_payment_processor = PaymentProcessor.objects.create(
name=os.environ.get("SBMTD_PAYMENT_PROCESSOR_NAME", "Test Payment Processor"),
api_base_url=os.environ.get("SBMTD_PAYMENT_PROCESSOR_API_BASE_URL", "http://server:8000"),
api_access_token_endpoint=os.environ.get("SBMTD_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_ENDPOINT", "access-token"),
api_access_token_request_key=os.environ.get("SBMTD_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_KEY", "request_access"),
api_access_token_request_val=os.environ.get("SBMTD_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_VAL", "REQUEST_ACCESS"),
card_tokenize_url=os.environ.get("SBMTD_PAYMENT_PROCESSOR_CARD_TOKENIZE_URL", "http://server:8000/static/tokenize.js"),
card_tokenize_func=os.environ.get("SBMTD_PAYMENT_PROCESSOR_CARD_TOKENIZE_FUNC", "tokenize"),
card_tokenize_env=os.environ.get("SBMTD_PAYMENT_PROCESSOR_CARD_TOKENIZE_ENV", "test"),
client_cert=sbmtd_payment_processor_client_cert,
client_cert_private_key=sbmtd_payment_processor_client_cert_private_key,
client_cert_root_ca=sbmtd_payment_processor_client_cert_root_ca,
customer_endpoint="customer",
customers_endpoint="customers",
group_endpoint="group",
)

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

# load the sample data from a JSON file so that it can be accessed by Cypress as well
Expand All @@ -262,7 +305,7 @@ def load_data(app, *args, **kwargs):
help_template="core/includes/help--mst.html",
)
mst_agency.eligibility_types.set([mst_senior_type, mst_veteran_type, mst_courtesy_card_type])
mst_agency.eligibility_verifiers.set([mst_oauth_claims_verifier, mst_veteran_verifier, mst_courtesy_card_verifier])
mst_agency.eligibility_verifiers.set([mst_senior_verifier, mst_veteran_verifier, mst_courtesy_card_verifier])

sacrt_agency = TransitAgency.objects.create(
slug="sacrt",
Expand All @@ -282,7 +325,27 @@ def load_data(app, *args, **kwargs):
enrollment_success_template="enrollment/success--sacrt.html",
)
sacrt_agency.eligibility_types.set([sacrt_senior_type])
sacrt_agency.eligibility_verifiers.set([sacrt_oauth_claims_verifier])
sacrt_agency.eligibility_verifiers.set([sacrt_senior_verifier])

sbmtd_agency = TransitAgency.objects.create(
slug="sbmtd",
short_name=os.environ.get("SBMTD_AGENCY_SHORT_NAME", "SBMTD (sample)"),
long_name=os.environ.get("SBMTD_AGENCY_LONG_NAME", "Santa Barbara MTD (sample)"),
agency_id="sbmtd",
merchant_id=os.environ.get("SBMTD_AGENCY_MERCHANT_ID", "sbmtd"),
info_url="https://sbmtd.gov/taptopride/",
phone="805-963-3366",
active=os.environ.get("SBMTD_AGENCY_ACTIVE", "True").lower() == "true",
private_key=client_private_key,
public_key=client_public_key,
jws_signing_alg=os.environ.get("SBMTD_AGENCY_JWS_SIGNING_ALG", "RS256"),
payment_processor=sbmtd_payment_processor,
index_template="core/index--sbmtd.html",
eligibility_index_template="eligibility/index--sbmtd.html",
enrollment_success_template="enrollment/success--sbmtd.html",
)
sbmtd_agency.eligibility_types.set([sbmtd_senior_type])
sbmtd_agency.eligibility_verifiers.set([sbmtd_senior_verifier])


class Migration(migrations.Migration):
Expand Down
7 changes: 7 additions & 0 deletions benefits/core/templates/core/index--sbmtd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "core/agency-index.html" %}

{% load i18n %}

{% block headline %}
{% translate "Get a reduced fare on Santa Barbara MTD buses when you tap to ride" %}
{% endblock headline %}
9 changes: 9 additions & 0 deletions benefits/eligibility/templates/eligibility/index--sbmtd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "eligibility/index.html" %}

{% load i18n %}

{% block explanatory-text %}
<p class="pt-4 pb-4 pb-lg-8">
{% translate "Cal-ITP doesn’t save any of your information. All SBMTD transit benefits give riders a reduced bus fare." %}
</p>
{% endblock explanatory-text %}
9 changes: 9 additions & 0 deletions benefits/enrollment/templates/enrollment/success--sbmtd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "enrollment/success.html" %}
{% load i18n %}

{% block success-message %}
{% blocktranslate trimmed %}
You were not charged anything today. When boarding an SBMTD bus, tap this card when you board and you will be
charged a reduced fare. If you change the card you use to pay for transit service, you will need to re-enroll.
{% endblocktranslate %}
{% endblock success-message %}
20 changes: 17 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: 2023-08-10 22:35+0000\n"
"POT-Creation-Date: 2023-08-14 21:37+0000\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -249,6 +249,9 @@ msgstr ""
msgid "Get a reduced fare on SacRT light rail when you tap to ride"
msgstr ""

msgid "Get a reduced fare on Santa Barbara MTD buses when you tap to ride"
msgstr ""

msgid "Choose transit agency"
msgstr ""

Expand Down Expand Up @@ -406,8 +409,8 @@ msgid ""
"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>."
"resources/verifying-your-identity-on-vagov/\" target=\"_blank\" "
"rel=\"noopener noreferrer\">verify your identity through VA.gov</a>."
msgstr ""

#, python-format
Expand All @@ -422,6 +425,11 @@ msgid ""
"reduce fares by 50%% for light rail."
msgstr ""

msgid ""
"Cal-ITP doesn’t save any of your information. All SBMTD transit benefits "
"give riders a reduced bus fare."
msgstr ""

msgid "Choose benefit option"
msgstr ""

Expand Down Expand Up @@ -533,6 +541,12 @@ msgid ""
"transit service."
msgstr ""

msgid ""
"You were not charged anything today. When boarding an SBMTD bus, tap this "
"card when you board and you will be charged a reduced fare. If you change "
"the card you use to pay for transit service, you will need to re-enroll."
msgstr ""

msgid "Success"
msgstr ""

Expand Down
35 changes: 28 additions & 7 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: 2023-08-10 22:35+0000\n"
"POT-Creation-Date: 2023-08-14 21:37+0000\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -284,8 +284,8 @@ msgstr ""
"califican para una serie de programas de tarifas reducidas. Este beneficio "
"de tránsito debe renovarse en el futuro en función de la fecha de "
"vencimiento de la tarjeta de cortesía. Obtenga más información en el <a "
"href='https://mst.org/riders-guide/how-to-ride/courtesy-card/' target="
"\"_blank\" rel=\"noopener noreferrer\">MST Riders Guide</a>."
"href='https://mst.org/riders-guide/how-to-ride/courtesy-card/' "
"target=\"_blank\" rel=\"noopener noreferrer\">MST Riders Guide</a>."

msgid "Sign out of Login.gov"
msgstr "Cierre sesión de Login.gov"
Expand Down Expand Up @@ -326,6 +326,11 @@ msgid "Get a reduced fare on SacRT light rail when you tap to ride"
msgstr ""
"Obtenga una tarifa reducida en el tren ligero SacRT cuando toque para viajar"

msgid "Get a reduced fare on Santa Barbara MTD buses when you tap to ride"
msgstr ""
"Obtenga una tarifa reducida en los autobuses del Santa Barbara MTD cuando "
"toque para viajar"

msgid "Choose transit agency"
msgstr "Elija la agencia de tránsito"

Expand Down Expand Up @@ -504,14 +509,14 @@ msgid ""
"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>."
"resources/verifying-your-identity-on-vagov/\" target=\"_blank\" "
"rel=\"noopener noreferrer\">verify your identity through VA.gov</a>."
msgstr ""
"Esta opción es para personas que hayan prestado servicio militar, naval o "
"aéreo de manera activa, y quienes fueron dados de baja o liberados en "
"condiciones que no hayan sido deshonrosas. Necesitará <a href='https://www."
"va.gov/resources/verifying-your-identity-on-vagov/' target=\"_blank\" rel="
"\"noopener noreferrer\">verificar su identidad a través de VA.gov</a>."
"va.gov/resources/verifying-your-identity-on-vagov/' target=\"_blank\" "
"rel=\"noopener noreferrer\">verificar su identidad a través de VA.gov</a>."

#, python-format
msgid ""
Expand All @@ -529,6 +534,13 @@ msgstr ""
"Cal-ITP no almacena su información. Todos los beneficios de tránsito de "
"SacRT reducen las tarifas del tren ligero en un 50%%."

msgid ""
"Cal-ITP doesn’t save any of your information. All SBMTD transit benefits "
"give riders a reduced bus fare."
msgstr ""
"Cal-ITP no almacena su información. Todos los beneficios de tránsito de "
"SBMTD le ofrecen a los pasajeros tarifas de autobús reducidas."

msgid "Choose benefit option"
msgstr "Elija la opción de beneficio"

Expand Down Expand Up @@ -652,6 +664,15 @@ msgstr ""
"cuando suba 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. When boarding an SBMTD bus, tap this "
"card when you board and you will be charged a reduced fare. If you change "
"the card you use to pay for transit service, you will need to re-enroll."
msgstr ""
"No se le cobró nada hoy. Al abordar un autobús de SBMTD, toque esta tarjeta "
"cuando suba 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 "Success"
msgstr "Éxito"

Expand Down
9 changes: 9 additions & 0 deletions benefits/static/img/agencies/sbmtd-lg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions benefits/static/img/agencies/sbmtd-sm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions terraform/app_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ resource "azurerm_linux_web_app" "main" {
"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)"
"SBMTD_SENIOR_GROUP_ID" = "${local.secret_prefix}sbmtd-senior-group-id)",
"CLIENT_PRIVATE_KEY" = "${local.secret_prefix}client-private-key)"
"CLIENT_PUBLIC_KEY" = "${local.secret_prefix}client-public-key)"
"SERVER_PUBLIC_KEY_URL" = "${local.secret_prefix}server-public-key-url)"
Expand All @@ -91,6 +92,9 @@ resource "azurerm_linux_web_app" "main" {
"SACRT_PAYMENT_PROCESSOR_CLIENT_CERT" = "${local.secret_prefix}sacrt-payment-processor-client-cert)"
"SACRT_PAYMENT_PROCESSOR_CLIENT_CERT_PRIVATE_KEY" = "${local.secret_prefix}sacrt-payment-processor-client-cert-private-key)"
"SACRT_PAYMENT_PROCESSOR_CLIENT_CERT_ROOT_CA" = "${local.secret_prefix}sacrt-payment-processor-client-cert-root-ca)"
"SBMTD_PAYMENT_PROCESSOR_CLIENT_CERT" = "${local.secret_prefix}sbmtd-payment-processor-client-cert)"
"SBMTD_PAYMENT_PROCESSOR_CLIENT_CERT_PRIVATE_KEY" = "${local.secret_prefix}sbmtd-payment-processor-client-cert-private-key)"
"SBMTD_PAYMENT_PROCESSOR_CLIENT_CERT_ROOT_CA" = "${local.secret_prefix}sbmtd-payment-processor-client-cert-root-ca)"
"AUTH_PROVIDER_CLIENT_ID" = "${local.secret_prefix}auth-provider-client-id)"
"AUTH_PROVIDER_AUTHORITY" = "${local.secret_prefix}auth-provider-authority)"
"SENIOR_AUTH_PROVIDER_CLIENT_NAME" = "${local.secret_prefix}senior-auth-provider-client-name)"
Expand All @@ -111,6 +115,7 @@ resource "azurerm_linux_web_app" "main" {
"COURTESY_CARD_VERIFIER_JWE_ENCRYPTION_ALG" = "${local.secret_prefix}courtesy-card-verifier-jwe-encryption-alg)"
"COURTESY_CARD_VERIFIER_JWS_SIGNING_ALG" = "${local.secret_prefix}courtesy-card-verifier-jws-signing-alg)"
"SACRT_OAUTH_VERIFIER_NAME" = "${local.secret_prefix}sacrt-oauth-verifier-name)"
"SBMTD_SENIOR_VERIFIER_NAME" = "${local.secret_prefix}sbmtd-senior-verifier-name"
"MST_PAYMENT_PROCESSOR_NAME" = "${local.secret_prefix}mst-payment-processor-name)"
"MST_PAYMENT_PROCESSOR_API_BASE_URL" = "${local.secret_prefix}mst-payment-processor-api-base-url)"
"MST_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_ENDPOINT" = "${local.secret_prefix}mst-payment-processor-api-access-token-endpoint)"
Expand All @@ -127,6 +132,14 @@ resource "azurerm_linux_web_app" "main" {
"SACRT_PAYMENT_PROCESSOR_CARD_TOKENIZE_URL" = "${local.secret_prefix}sacrt-payment-processor-card-tokenize-url)"
"SACRT_PAYMENT_PROCESSOR_CARD_TOKENIZE_FUNC" = "${local.secret_prefix}sacrt-payment-processor-card-tokenize-func)"
"SACRT_PAYMENT_PROCESSOR_CARD_TOKENIZE_ENV" = "${local.secret_prefix}sacrt-payment-processor-card-tokenize-env)"
"SBMTD_PAYMENT_PROCESSOR_NAME" = "${local.secret_prefix}sbmtd-payment-processor-name)"
"SBMTD_PAYMENT_PROCESSOR_API_BASE_URL" = "${local.secret_prefix}sbmtd-payment-processor-api-base-url)"
"SBMTD_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_ENDPOINT" = "${local.secret_prefix}sbmtd-payment-processor-api-access-token-endpoint)"
"SBMTD_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_KEY" = "${local.secret_prefix}sbmtd-payment-processor-api-access-token-request-key)"
"SBMTD_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_VAL" = "${local.secret_prefix}sbmtd-payment-processor-api-access-token-request-val)"
"SBMTD_PAYMENT_PROCESSOR_CARD_TOKENIZE_URL" = "${local.secret_prefix}sbmtd-payment-processor-card-tokenize-url)"
"SBMTD_PAYMENT_PROCESSOR_CARD_TOKENIZE_FUNC" = "${local.secret_prefix}sbmtd-payment-processor-card-tokenize-func)"
"SBMTD_PAYMENT_PROCESSOR_CARD_TOKENIZE_ENV" = "${local.secret_prefix}sbmtd-payment-processor-card-tokenize-env)"
"MST_AGENCY_SHORT_NAME" = "${local.secret_prefix}mst-agency-short-name)"
"MST_AGENCY_LONG_NAME" = "${local.secret_prefix}mst-agency-long-name)"
"MST_AGENCY_JWS_SIGNING_ALG" = "${local.secret_prefix}mst-agency-jws-signing-alg)"
Expand All @@ -135,6 +148,11 @@ resource "azurerm_linux_web_app" "main" {
"SACRT_AGENCY_MERCHANT_ID" = "${local.secret_prefix}sacrt-agency-merchant-id)"
"SACRT_AGENCY_ACTIVE" = "${local.secret_prefix}sacrt-agency-active)"
"SACRT_AGENCY_JWS_SIGNING_ALG" = "${local.secret_prefix}sacrt-agency-jws-signing-alg)"
"SBMTD_AGENCY_SHORT_NAME" = "${local.secret_prefix}sbmtd-agency-short-name)"
"SBMTD_AGENCY_LONG_NAME" = "${local.secret_prefix}sbmtd-agency-long-name)"
"SBMTD_AGENCY_MERCHANT_ID" = "${local.secret_prefix}sbmtd-agency-merchant-id)"
"SBMTD_AGENCY_ACTIVE" = "${local.secret_prefix}sbmtd-agency-active)"
"SBMTD_AGENCY_JWS_SIGNING_ALG" = "${local.secret_prefix}sbmtd-agency-jws-signing-alg)"
}

lifecycle {
Expand Down

0 comments on commit b251c74

Please sign in to comment.