Skip to content

Commit

Permalink
Feat: enrollment success (#2067)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalver1 authored May 20, 2024
2 parents 6500936 + 3e67b99 commit c07ae69
Show file tree
Hide file tree
Showing 15 changed files with 223 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.0.3 on 2024-05-17 19:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("core", "0010_alter_secret_name_field_blank"),
]

operations = [
migrations.RemoveField(
model_name="transitagency",
name="enrollment_success_template",
),
migrations.AddField(
model_name="eligibilitytype",
name="enrollment_success_template",
field=models.TextField(default="enrollment/success.html"),
),
]
21 changes: 12 additions & 9 deletions benefits/core/migrations/local_fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"fields": {
"name": "senior",
"label": "(MST) Senior Discount",
"group_id": "group123"
"group_id": "group123",
"enrollment_success_template": "enrollment/success--mst.html"
}
},
{
Expand All @@ -78,7 +79,8 @@
"fields": {
"name": "veteran",
"label": "(MST) Veteran Discount",
"group_id": "group123"
"group_id": "group123",
"enrollment_success_template": "enrollment/success--mst.html"
}
},
{
Expand All @@ -88,7 +90,8 @@
"name": "courtesy_card",
"label": "(MST) Courtesy Card Discount",
"group_id": "group123",
"enrollment_index_template": "enrollment/index--agency-card.html"
"enrollment_index_template": "enrollment/index--agency-card.html",
"enrollment_success_template": "enrollment/success--mst-courtesy-card.html"
}
},
{
Expand All @@ -97,7 +100,8 @@
"fields": {
"name": "senior",
"label": "(SacRT) Senior Discount",
"group_id": "group123"
"group_id": "group123",
"enrollment_success_template": "enrollment/success--sacrt.html"
}
},
{
Expand All @@ -106,7 +110,8 @@
"fields": {
"name": "senior",
"label": "(SBMTD) Senior Discount",
"group_id": "group123"
"group_id": "group123",
"enrollment_success_template": "enrollment/success--sbmtd.html"
}
},
{
Expand All @@ -116,7 +121,8 @@
"name": "mobility_pass",
"label": "(SBMTD) Mobility Pass Discount",
"group_id": "group123",
"enrollment_index_template": "enrollment/index--agency-card.html"
"enrollment_index_template": "enrollment/index--agency-card.html",
"enrollment_success_template": "enrollment/success--sbmtd-mobility-pass.html"
}
},
{
Expand Down Expand Up @@ -340,7 +346,6 @@
"jws_signing_alg": "RS256",
"index_template": "core/index--mst.html",
"eligibility_index_template": "eligibility/index--mst.html",
"enrollment_success_template": "enrollment/success--mst.html",
"eligibility_types": [1, 7, 2, 3],
"eligibility_verifiers": [1, 7, 2, 3]
}
Expand All @@ -363,7 +368,6 @@
"jws_signing_alg": "RS256",
"index_template": "core/index--sacrt.html",
"eligibility_index_template": "eligibility/index--sacrt.html",
"enrollment_success_template": "enrollment/success--sacrt.html",
"eligibility_types": [4],
"eligibility_verifiers": [4]
}
Expand All @@ -386,7 +390,6 @@
"jws_signing_alg": "RS256",
"index_template": "core/index--sbmtd.html",
"eligibility_index_template": "eligibility/index--sbmtd.html",
"enrollment_success_template": "enrollment/success--sbmtd.html",
"eligibility_types": [5, 6],
"eligibility_verifiers": [5, 6]
}
Expand Down
2 changes: 1 addition & 1 deletion benefits/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class EligibilityType(models.Model):
expiration_reenrollment_days = models.PositiveSmallIntegerField(null=True, blank=True)
enrollment_index_template = models.TextField(default="enrollment/index.html")
reenrollment_error_template = models.TextField(null=True, blank=True)
enrollment_success_template = models.TextField(default="enrollment/success.html")

def __str__(self):
return self.label
Expand Down Expand Up @@ -276,7 +277,6 @@ class TransitAgency(models.Model):
jws_signing_alg = models.TextField()
index_template = models.TextField()
eligibility_index_template = models.TextField()
enrollment_success_template = models.TextField()

def __str__(self):
return self.long_name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends "enrollment/success.html" %}
{% load i18n %}

{% block headline-message %}
{% blocktranslate trimmed %}
You can now use your contactless card to tap to ride with a reduced fare!
{% endblocktranslate %}
{% endblock headline-message %}

{% block success-message %}
{% blocktranslate trimmed %}
Your contactless card is now enrolled in an MST Courtesy Card transit benefit. When boarding an MST bus, tap this card and you will be
charged a reduced fare. You will need to re-enroll if you choose to change the card you use to pay for transit service.
{% endblocktranslate %}
{% endblock success-message %}

{% block thank-you-message %}
{% blocktranslate trimmed %}
You were not charged anything today. Thank you for using Cal-ITP Benefits!
{% endblocktranslate %}
{% endblock thank-you-message %}
2 changes: 1 addition & 1 deletion benefits/enrollment/templates/enrollment/success--mst.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% block success-message %}
{% blocktranslate trimmed %}
You were not charged anything today. When boarding an MST fixed route bus, tap this card when you board and you will be
You were not charged anything today. When boarding an MST bus, tap this card and you will be
charged a reduced fare. You will need to re-enroll if you choose to change the card you use to pay for transit service.
{% endblocktranslate %}
{% endblock success-message %}
4 changes: 2 additions & 2 deletions benefits/enrollment/templates/enrollment/success--sacrt.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% block success-message %}
{% blocktranslate trimmed %}
You were not charged anything today. When boarding SacRT light rail, tap this card when you board and you will be charged
a reduced fare. You will need to re-enroll if you choose to change the card you use to pay for transit service.
You were not charged anything today. When boarding SacRT light rail, tap this card and you will be
charged a reduced fare. You will need to re-enroll if you choose to change the card you use to pay for transit service.
{% endblocktranslate %}
{% endblock success-message %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends "enrollment/success.html" %}
{% load i18n %}

{% block headline-message %}
{% blocktranslate trimmed %}
You can now use your contactless card to tap to ride with a reduced fare!
{% endblocktranslate %}
{% endblock headline-message %}

{% block success-message %}
{% blocktranslate trimmed %}
Your contactless card is now enrolled in an SBMTD Reduced Fare Mobility ID transit benefit. When boarding an SBMTD bus, tap this card and you will be
charged a reduced fare. You will need to re-enroll if you choose to change the card you use to pay for transit service.
{% endblocktranslate %}
{% endblock success-message %}

{% block thank-you-message %}
{% blocktranslate trimmed %}
You were not charged anything today. Thank you for using Cal-ITP Benefits!
{% endblocktranslate %}
{% endblock thank-you-message %}
4 changes: 2 additions & 2 deletions benefits/enrollment/templates/enrollment/success--sbmtd.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% 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.
You were not charged anything today. When boarding an SBMTD bus, tap this card and you will be
charged a reduced fare. You will need to re-enroll if you choose to change the card you use to pay for transit service.
{% endblocktranslate %}
{% endblock success-message %}
16 changes: 12 additions & 4 deletions benefits/enrollment/templates/enrollment/success.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,34 @@

{% block headline %}
<div class="col-lg-8">
<h1 class="pb-lg-4 mb-lg-3 pb-4">{% translate "Success! Your transit benefit is now connected to your card." %}</h1>
<h1 class="pb-lg-4 mb-lg-3 pb-4">
{% block headline-message %}
{% translate "Success! Your transit benefit is now connected to your card." %}
{% endblock headline-message %}
</h1>
</div>
{% endblock headline %}

{% block inner-content %}
<div class="col-12 col-sm-12 col-lg-9">
<div class="row flex-column-reverse flex-lg-row">
<div class="col-12 col-lg-7">
<div class="col-12 col-lg-7 pe-1">
{# djlint:off #}
{% if enrollment.supports_expiration %}
<h2 class="h3 mt-lg-3 mb-1">{% translate "Your benefit will expire on" %} {{ enrollment.expires|date }}.</h2>
<p>
{% else %}
<p class="pt-lg-4 mt-lg-3">
<p class="pt-lg-3 mt-lg-0">
{% endif %}
{% block success-message %}
{% endblock success-message %}
</p>
{# djlint:on #}
<p class="pt-4">{% translate "Thank you for using Cal-ITP Benefits!" %}</p>
<p class="pt-4">
{% block thank-you-message %}
{% translate "Thank you for using Cal-ITP Benefits!" %}
{% endblock thank-you-message %}
</p>
</div>
<div class="col-12 col-lg-5">
<img width="180"
Expand Down
5 changes: 2 additions & 3 deletions benefits/enrollment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
ROUTE_TOKEN = "enrollment:token"

TEMPLATE_RETRY = "enrollment/retry.html"
TEMPLATE_SUCCESS = "enrollment/success.html"


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -152,12 +151,12 @@ def success(request):
request.path = "/enrollment/success"
session.update(request, origin=reverse(ROUTE_SUCCESS))

agency = session.agency(request)
eligibility = session.eligibility(request)
verifier = session.verifier(request)

if session.logged_in(request) and verifier.auth_provider.supports_sign_out:
# overwrite origin for a logged in user
# if they click the logout button, they are taken to the new route
session.update(request, origin=reverse(ROUTE_LOGGED_OUT))

return TemplateResponse(request, agency.enrollment_success_template)
return TemplateResponse(request, eligibility.enrollment_success_template)
47 changes: 37 additions & 10 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-05-15 16:02+0000\n"
"POT-Creation-Date: 2024-05-16 19:45+0000\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -645,23 +645,50 @@ msgid ""
msgstr ""

msgid ""
"You were not charged anything today. When boarding an MST fixed route bus, "
"tap this card when you board and you will be charged a reduced fare. You "
"will need to re-enroll if you choose to change the card you use to pay for "
"transit service."
"You can now use your contactless card to tap to ride with a reduced fare!"
msgstr ""

msgid ""
"Your contactless card is now enrolled in an MST Courtesy Card transit "
"benefit. When boarding an MST bus, tap this card and you will be charged a "
"reduced fare. You will need to re-enroll if you choose to change the card "
"you use to pay for transit service."
msgstr ""

msgid ""
"You were not charged anything today. Thank you for using Cal-ITP Benefits!"
msgstr ""

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

msgid ""
"Your contactless card is now enrolled in a SacRT light rail transit benefit. "
"When boarding SacRT light rail, tap this card and you will be charged a "
"reduced fare. You will need to re-enroll if you choose to change the card "
"you use to pay for transit service."
msgstr ""

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

msgid ""
"Your contactless card is now enrolled in an SBMTD Reduced Fare Mobility ID "
"transit benefit. When boarding an SBMTD bus, tap this card and you will be "
"charged a reduced fare. You will need to re-enroll if you choose to change "
"the card you use to pay for 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."
"card and you will be charged a reduced fare. You will need to re-enroll if "
"you choose to change the card you use to pay for transit service."
msgstr ""

msgid "Success"
Expand Down
Loading

0 comments on commit c07ae69

Please sign in to comment.