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

Release 2023.12.1 #1807

Merged
merged 119 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
0a961c2
chore(deploy): pip freeze to a static file
thekaveman Sep 19, 2023
fe2f5da
chore(docker): remove platform designation, no longer needed
machikoyasuda Sep 20, 2023
59f2a1f
chore(tests): use coverage directly to run tests
thekaveman Sep 21, 2023
fba49f4
chore(ci): add coverage comment step
thekaveman Sep 21, 2023
1a3654c
chore(tests): rename sample classes
thekaveman Sep 21, 2023
c3b8720
fix(coverage): run with relative files on
thekaveman Sep 21, 2023
7c292f9
chore(coverage): only analyze app code
thekaveman Sep 21, 2023
3fa9c9e
docs: adding veterans use case
indexing Sep 22, 2023
95362a0
chore(pre-commit): autofix run
pre-commit-ci[bot] Sep 22, 2023
9251453
Update docs/use-cases/Veterans.md
indexing Sep 22, 2023
80564d2
chore(pre-commit): autofix run
pre-commit-ci[bot] Sep 22, 2023
597eb50
docs: replacing diagram image with mermaid code
indexing Sep 22, 2023
dcb955a
docs: removing clickup garbage in some link URLs
indexing Sep 22, 2023
60ad329
docs: removed bolding on h2 headings
indexing Sep 25, 2023
85a130d
Docker: Revert platform change (#1743)
machikoyasuda Sep 25, 2023
9d6f555
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Sep 25, 2023
d3f78ac
docs: update section title to use sentence case
indexing Sep 26, 2023
3d5aa81
docs: update section title to use sentence case
indexing Sep 26, 2023
0e07007
docs: update section title to use sentence case
indexing Sep 26, 2023
a792131
Docs: adding veterans use case (#1748)
machikoyasuda Sep 26, 2023
f6a2974
chore(pre-commit): autoupdate hooks (#1749)
machikoyasuda Sep 27, 2023
280e9d9
chore(deploy): use pipdeptree instead of pip freeze
thekaveman Sep 27, 2023
e22bef2
Tests: add coverage comments to PRs (#1745)
thekaveman Sep 27, 2023
cde410a
chore(deps-dev): bump cypress from 13.2.0 to 13.3.0 in /tests/cypress
dependabot[bot] Sep 27, 2023
4ab5416
Chore: add pip metadata file to app container (#1733)
thekaveman Sep 28, 2023
db7d8c8
fix: do not show scrollbar when not necessary
machikoyasuda Oct 2, 2023
a9a80f9
chore(deps-dev): bump cypress from 13.2.0 to 13.3.0 in /tests/cypress…
machikoyasuda Oct 3, 2023
b3fc711
fix: do not show scrollbar when not necessary (#1752)
machikoyasuda Oct 3, 2023
54bdb1b
chore(deps-dev): bump django from 4.2.5 to 4.2.6
dependabot[bot] Oct 4, 2023
ef11391
chore(deps-dev): bump django from 4.2.5 to 4.2.6 (#1753)
machikoyasuda Oct 5, 2023
e8b1502
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Oct 9, 2023
23e95f3
chore(pre-commit): autoupdate hooks (#1754)
machikoyasuda Oct 10, 2023
5741985
chore(deps-dev): bump sentry-sdk from 1.31.0 to 1.32.0
dependabot[bot] Oct 11, 2023
aafef1e
chore: chmod +x on scripts
thekaveman Oct 11, 2023
06d9029
feat: helper script restarts app
thekaveman Oct 11, 2023
edbce73
chore(deps-dev): bump cypress from 13.3.0 to 13.3.2 in /tests/cypress
dependabot[bot] Oct 18, 2023
87cf952
chore(deps-dev): bump cypress from 13.3.0 to 13.3.2 in /tests/cypress…
thekaveman Oct 23, 2023
3e54a6e
Fix: helper scripts (#1757)
thekaveman Oct 23, 2023
6feea1b
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Oct 23, 2023
b1c774e
chore(pre-commit): autoupdate hooks (#1760)
thekaveman Oct 23, 2023
ef14351
chore(deps-dev): bump sentry-sdk from 1.31.0 to 1.32.0 (#1756)
thekaveman Oct 23, 2023
3269f30
chore(deps-dev): bump cypress from 13.3.2 to 13.3.3 in /tests/cypress
dependabot[bot] Oct 24, 2023
3d95092
chore(deps-dev): bump cypress from 13.3.2 to 13.3.3 in /tests/cypress…
machikoyasuda Oct 24, 2023
f0bd052
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Oct 30, 2023
4c6d891
chore(deps-dev): bump cypress from 13.3.3 to 13.4.0 in /tests/cypress
dependabot[bot] Oct 30, 2023
e11aa0d
chore(deps-dev): bump cypress from 13.3.3 to 13.4.0 in /tests/cypress…
machikoyasuda Oct 31, 2023
eec154a
chore(pre-commit): autoupdate hooks (#1765)
machikoyasuda Oct 31, 2023
f2ad63d
feat(sbtmd): add Mobility Pass EligibilityType, EligibilityVerifier -…
machikoyasuda Nov 1, 2023
1f5ae46
feat(sbmtd): add templates for media item, selection label, elig start
machikoyasuda Nov 1, 2023
a44b852
feat(stmtd): add Mobility Pass form
machikoyasuda Nov 1, 2023
53a2eb6
chore(devcontainer): replace deprecated extensions, update settings
thekaveman Nov 1, 2023
d79f6d0
feat(sbmtd): spanish copy
machikoyasuda Nov 1, 2023
70ea25d
refactor(test): less dependence on database contents
thekaveman Nov 1, 2023
a203f0b
feat(init): parameterize the database directory
thekaveman Nov 1, 2023
e54bead
feat(settings): use DJANGO_DB_DIR in database config
thekaveman Nov 1, 2023
305bcd2
docs: describe DJANGO_DB_DIR env var
thekaveman Nov 1, 2023
58c9c68
feat(init): guard database delete with env var
thekaveman Nov 1, 2023
0839086
docs: describe DJANGO_DB_RESET env var
thekaveman Nov 1, 2023
2c44fea
Chore: clean up devcontainer (#1769)
thekaveman Nov 1, 2023
6c8f82e
feat(terraform): map DJANGO_DB config to key vault secrets
thekaveman Nov 1, 2023
ea4edac
feat(stmtd): add Help q/a
machikoyasuda Nov 1, 2023
a0654c6
feat(sbmtd): new server public key var
machikoyasuda Nov 1, 2023
2ecbf53
chore: run makemessages
machikoyasuda Nov 1, 2023
b9cdb3a
chore: rereun makemessages
machikoyasuda Nov 1, 2023
aef5c67
feat(sbmtd): add sbmtd, mst-specific server public key env vars
machikoyasuda Nov 2, 2023
fcf009b
Feat: parameterize Django database path/deletion (#1770)
thekaveman Nov 2, 2023
b2836eb
feat(terraform): define Azure file share
thekaveman Nov 2, 2023
bae7fab
feat(terraform): mount Azure file share into app container
thekaveman Nov 2, 2023
c2e6574
feat(sbmtd): add SBMTD_MOBILITY_PASS_GROUP_ID
machikoyasuda Nov 2, 2023
e209a18
fix(sbmtd): add sbmtd mobility pass eligibility type to sbmtd
machikoyasuda Nov 6, 2023
c99b74d
Feat: create and mount Azure file share (#1775)
thekaveman Nov 8, 2023
c5f1972
Feat: Add SBTMD Mobility Pass configuration (#1771)
machikoyasuda Nov 8, 2023
13b24c0
feat(init): create superuser without input
thekaveman Nov 8, 2023
284f6aa
feat(terraform): Django superuser app settings
thekaveman Nov 8, 2023
b9d2ecb
docs(config): describe Django superuser env vars
thekaveman Nov 8, 2023
10bf6fc
feat(sbmtd): add SBMTD Mobility Pass vars to Terraform
machikoyasuda Nov 9, 2023
be911ce
chore(deps-dev): bump cypress from 13.4.0 to 13.5.0 in /tests/cypress
dependabot[bot] Nov 9, 2023
08b52c1
Feat: Unattended superuser creation (#1778)
thekaveman Nov 9, 2023
bd4aa14
chore(nginx): block sqlite scraper patterns
thekaveman Nov 9, 2023
e67ad9b
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Nov 13, 2023
1ec947b
chore(deps-dev): bump cypress from 13.4.0 to 13.5.0 in /tests/cypress…
thekaveman Nov 13, 2023
0b67412
chore(deps-dev): bump sentry-sdk from 1.32.0 to 1.35.0
dependabot[bot] Nov 13, 2023
2cbf823
chore(deps-dev): bump cypress from 13.5.0 to 13.5.1 in /tests/cypress
dependabot[bot] Nov 14, 2023
41b4c9d
chore(pre-commit): autoupdate hooks (#1782)
machikoyasuda Nov 15, 2023
b72a1e4
chore(deps-dev): bump cypress from 13.5.0 to 13.5.1 in /tests/cypress…
machikoyasuda Nov 15, 2023
c96bbf8
chore(deps-dev): bump sentry-sdk from 1.32.0 to 1.35.0 (#1784)
machikoyasuda Nov 15, 2023
433a987
chore(deps-dev): bump django from 4.2.6 to 4.2.7
dependabot[bot] Nov 15, 2023
10da104
Chore: block Sqlite scraper patterns (#1781)
thekaveman Nov 15, 2023
05a77e5
chore(deps-dev): bump django from 4.2.6 to 4.2.7 (#1768)
angela-tran Nov 15, 2023
27a93cf
Update terraform/app_service.tf
machikoyasuda Nov 15, 2023
d93eec9
fix(enrollment): show retry button on retry page
machikoyasuda Nov 16, 2023
39753d5
refactor(enrollment): remove retry variable entirely
machikoyasuda Nov 16, 2023
f1d9790
Add SBMTD Mobility Pass vars to Terraform (#1779)
machikoyasuda Nov 16, 2023
3446877
Show retry button on enrollment/retry page (#1787)
machikoyasuda Nov 16, 2023
518f38e
fix(terraform): typo in secret name
thekaveman Nov 16, 2023
8663f2c
Fix: typo in secret name (#1788)
thekaveman Nov 16, 2023
b0e42fb
fix(copy): back of card, not both front and back
machikoyasuda Nov 16, 2023
9c35614
fix(typo): 4-digit
machikoyasuda Nov 16, 2023
c5365bc
fix(copy): Mobility Pass card
machikoyasuda Nov 16, 2023
81f62b4
Fix: back of card, not both front and back (#1793)
machikoyasuda Nov 17, 2023
2d0b901
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Nov 20, 2023
49c4dad
chore(pre-commit): autoupdate hooks (#1794)
thekaveman Nov 20, 2023
edd35c4
Deploy to test (#1790)
thekaveman Nov 20, 2023
accd1ba
chore(deps-dev): bump cypress from 13.5.1 to 13.6.0 in /tests/cypress
dependabot[bot] Nov 22, 2023
556095a
chore(deps-dev): bump sentry-sdk from 1.35.0 to 1.38.0
dependabot[bot] Nov 29, 2023
a774dfc
docs: add extension to make nested lists work
angela-tran Nov 30, 2023
2df4969
Docs: add extension to make nested lists work (#1800)
angela-tran Nov 30, 2023
121f138
chore(deps-dev): bump sentry-sdk from 1.35.0 to 1.38.0 (#1799)
thekaveman Dec 1, 2023
f25d228
chore(deps-dev): bump cypress from 13.5.1 to 13.6.0 in /tests/cypress…
thekaveman Dec 1, 2023
bbb9983
chore(git): ignore python venv
thekaveman Dec 1, 2023
083e1bc
fix(init): rename then delete old database on reset
thekaveman Dec 1, 2023
9ac066b
Fix: attempt db rename during reset (#1801)
thekaveman Dec 1, 2023
10f8a0b
Deploy to test (#1802)
thekaveman Dec 1, 2023
1f2b94b
fix(enrollment): update re-enrollment error handling
thekaveman Dec 1, 2023
87b2671
test(enrollment): update tests for error condition
thekaveman Dec 1, 2023
9738532
Fix: Re-enrollment (#1804)
thekaveman Dec 1, 2023
7947476
chore: bump version to 2023.12.1
angela-tran Dec 1, 2023
ce953c9
Prepare 2023.12.1 release (#1805)
angela-tran Dec 1, 2023
36fd3ba
Deploy 2023.12.1 to test (#1806)
angela-tran Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"bungcip.better-toml",
"batisteo.vscode-django",
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"hashicorp.terraform",
"mhutchie.git-graph",
"monosans.djlint",
"ms-python.python",
"ms-python.vscode-pylance",
"mrorz.language-gettext",
"qwtel.sqlite-viewer"
"ms-python.python",
"ms-python.black-formatter",
"ms-python.flake8",
"qwtel.sqlite-viewer",
"tamasfe.even-better-toml"
]
}
}
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version-file: .github/workflows/.python-version
cache: pip
cache-dependency-path: "**/pyproject.toml"

- name: Write python packages to file
run: |
python -m venv .venv
source .venv/bin/activate
pip install pipdeptree
pip install -e .
pipdeptree
pipdeptree >> benefits/static/requirements.txt

- name: Write commit SHA to file
run: echo "${{ github.sha }}" >> benefits/static/sha.txt

Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/tests-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ on: [push, pull_request]
jobs:
pytest:
runs-on: ubuntu-latest
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for pushing data to the
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -34,3 +42,10 @@ jobs:
with:
name: coverage-report
path: benefits/static/coverage

- name: Coverage comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_GREEN: 90
MINIMUM_ORANGE: 80
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ benefits/static/sha.txt
__pycache__/
.coverage
.DS_Store
.venv
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ default_stages:

repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.4.0
rev: v3.0.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
Expand All @@ -34,7 +34,7 @@ repos:
args: ["--maxkb=1500"]

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black
types:
Expand All @@ -55,12 +55,12 @@ repos:
files: .py$

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
types_or: [javascript, css]

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.32.1
rev: v1.34.0
hooks:
- id: djlint-django
11 changes: 2 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"[python]": {
"editor.defaultFormatter": "ms-python.python"
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "black",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.testing.pytestArgs": [
"tests/pytest",
"--import-mode=importlib",
"--no-migrations"
],
"python.testing.pytestArgs": ["tests/pytest"],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"[terraform]": {
Expand Down
2 changes: 1 addition & 1 deletion appcontainer/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ http {

# 404 known scraping file targets
# case-insensitive regex matches the given file extension anywhere in the request path
location ~* /.*\.(ash|asp|axd|cgi|com|env|json|php|ping|xml|ya?ml) {
location ~* /.*\.(ash|asp|axd|cgi|com|db|env|json|php|ping|sqlite|xml|ya?ml) {
access_log off;
log_not_found off;
return 404;
Expand Down
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 card)"),
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 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 4-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 %}
16 changes: 5 additions & 11 deletions benefits/enrollment/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, response):
class GroupResponse:
"""Benefits Enrollment Customer Group API response."""

def __init__(self, response, requested_id, payload=None):
def __init__(self, response, requested_id, group_id, payload=None):
if payload is None:
try:
payload = response.json()
Expand All @@ -74,18 +74,12 @@ def __init__(self, response, requested_id, payload=None):
else:
try:
# Group API uses an error response (500) to indicate that the customer already exists in the group (!!!)
# The error message should contain the customer ID we sent via payload and start with "Duplicate"
# The error message should contain the customer ID and group ID we sent via payload
error = response.json()["errors"][0]
customer_id = payload[0]
detail = error["detail"]

failure = (
customer_id is None
or detail is None
or customer_id not in detail
or customer_id in detail
and not detail.startswith("Duplicate")
)
failure = customer_id is None or detail is None or not (customer_id in detail and group_id in detail)

if failure:
raise ApiError("Invalid response format")
Expand Down Expand Up @@ -269,10 +263,10 @@ def enroll(self, customer_token, group_id):

if r.status_code in (200, 201):
logger.info("Customer enrolled in group")
return GroupResponse(r, customer.id)
return GroupResponse(r, customer.id, group_id)
elif r.status_code == 500:
logger.info("Customer already exists in group")
return GroupResponse(r, customer.id, payload=payload)
return GroupResponse(r, customer.id, group_id, payload=payload)
else:
r.raise_for_status()
except requests.ConnectionError:
Expand Down
12 changes: 5 additions & 7 deletions benefits/enrollment/templates/enrollment/retry.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ <h1 class="h2 text-center">
<div class="col-lg-8">{% include "core/includes/agency-links.html" %}</div>
</div>

{% if retry_button %}
<div class="row pt-8 justify-content-center">
<div class="col-lg-3 col-8">
{% translate "Try again" as button_text %}
{% include "core/includes/button--origin.html" with button_text=button_text %}
</div>
<div class="row pt-8 justify-content-center">
<div class="col-lg-3 col-8">
{% translate "Try again" as button_text %}
{% include "core/includes/button--origin.html" with button_text=button_text %}
</div>
{% endif %}
</div>

</div>
{% endblock main-content %}
Loading
Loading