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

Deploy 2024.06.1 to test #2175

Merged
merged 166 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
f9ae141
chore: update docs on tagging a release
angela-tran May 15, 2024
66812b6
Roadmap revisions
indexing May 17, 2024
6500936
Roadmap revisions (#2106)
indexing May 17, 2024
734517d
feat(enrollment): update TransitAgency and EligibilityType models
lalver1 May 3, 2024
c761703
feat(enrollment): update TransitAgency and EligibilityType migrations
lalver1 May 14, 2024
d58eaa2
feat(enrollment): update enrollment view
lalver1 May 14, 2024
5cd8e4e
feat(enrollment): update success message copy
lalver1 May 20, 2024
3739f48
feat(enrollment): update spanish translations
lalver1 May 16, 2024
3e67b99
feat(enrollment): update fixtures and tests
lalver1 May 16, 2024
c07ae69
Feat: enrollment success (#2067)
lalver1 May 20, 2024
9e12645
refactor: show system enrollment error page if 500 during linking
angela-tran Apr 30, 2024
9605c5d
chore: remove style class that no longer exists
angela-tran May 13, 2024
8dee229
feat: implement system enrollment error page template
angela-tran May 13, 2024
d8c2e70
feat(sentry): ensure 500 error during link still sends Sentry event
angela-tran May 13, 2024
852416b
chore: run makemessages helper script
angela-tran May 14, 2024
1138b27
test: add coverage for session origin getting updated
angela-tran May 14, 2024
deb9f68
refactor: move session update into system_error view function
angela-tran May 14, 2024
95ec106
chore(copy): update page title, translations for system enrollment error
thekaveman May 20, 2024
1a15409
Feat: system enrollment error - 500 error when linking (#2088)
thekaveman May 20, 2024
223fd4f
chore(ci): only tag Docker image with SHA
thekaveman May 21, 2024
98fc86a
ci(deploy): azure/webapps-deploy deploys new image
thekaveman May 21, 2024
9f48635
refactor: show system enrollment error page if 500 during /token
angela-tran May 1, 2024
7f1878f
CI: deploy Azure Web App with GitHub Actions (#2111)
thekaveman May 21, 2024
2320959
---
dependabot[bot] May 21, 2024
3d90770
feat(analytics): send analytic event when 500 error during /token
angela-tran May 21, 2024
2953bb6
test(sentry): add assertion for sentry method call
angela-tran May 21, 2024
3769a00
refactor: send sentry notification if any exception occurs during /token
angela-tran May 21, 2024
746f322
refactor: show server error page if 400 or other exception during /token
angela-tran May 22, 2024
70624c1
test: add coverage for misconfigured payment processor client id
angela-tran May 22, 2024
c238834
Feat: system enrollment error - 500 error during /token (#2089)
angela-tran May 22, 2024
15b81a5
chore: add logging statement for /token exceptions
angela-tran May 22, 2024
93e5130
feat: handle errors from calling `ensure_active_token`
angela-tran May 22, 2024
1ca7cce
fix: prevent enrollment button from being enabled if redirecting
angela-tran May 22, 2024
8506b7b
feat: handle errors from littlepay Client instantiation
angela-tran May 22, 2024
64c404b
docs: add details about tag annotation
angela-tran May 23, 2024
2b4ef00
feat: update onError callback to send to system error or server error
angela-tran May 23, 2024
1844bce
chore(deps): bump django-admin-sortable2 from 2.1.10 to 2.2.1
dependabot[bot] May 23, 2024
be4c325
chore(deps): bump django-admin-sortable2 from 2.1.10 to 2.2.1 (#2107)
angela-tran May 23, 2024
668ccd8
---
dependabot[bot] May 23, 2024
d5bfad9
chore(deps): bump mkdocs-material from 9.5.22 to 9.5.24 (#2109)
angela-tran May 23, 2024
240e211
chore(deps-dev): bump cypress from 13.9.0 to 13.10.0 in /tests/cypres…
angela-tran May 23, 2024
0bcf280
---
dependabot[bot] May 24, 2024
91cb369
chore(deps): bump requests from 2.31.0 to 2.32.2 (#2112)
angela-tran May 24, 2024
c172c56
ci: add initial workflow definition for checking makemigrations
angela-tran May 24, 2024
f42e6a3
ci: add steps needed to set up environment
angela-tran May 24, 2024
52e0906
ci: add step to run helper script and check output
angela-tran May 24, 2024
bdde33b
feat(terraform): config for new GitHub Actions based deploy
thekaveman May 25, 2024
54a88b3
docs(deployment): update with new GitHub Actions info
thekaveman May 25, 2024
82dc82f
chore(deps): bump mkdocs-material from 9.5.24 to 9.5.25
dependabot[bot] May 27, 2024
b5c20c2
Chore: update docs on tagging a release (#2104)
angela-tran May 28, 2024
4103826
chore: add comment clarifying why early return is needed
angela-tran May 28, 2024
ce12a50
chore: move route name into the app it belongs to
angela-tran May 28, 2024
8fbb987
refactor(oauth): update view to handle integer claims
lalver1 May 21, 2024
b08e2ec
refactor(oauth): update tests to handle integer claims
lalver1 May 22, 2024
540e46e
chore(deps): bump requests from 2.32.2 to 2.32.3
dependabot[bot] May 29, 2024
dd13db0
Refactor: use integer claims in OAuth (#2116)
lalver1 May 29, 2024
b55ab5e
fix(test): assertions for missing claim on AuthProvider were not correct
angela-tran May 30, 2024
cea5e5d
refactor(tests): rename some verifier fixtures to clarify intent
angela-tran May 30, 2024
c8f7949
refactor(tests): use model objects instead of Mock objects for verifier
angela-tran May 30, 2024
2f4ccda
fix(test): use fixture that matches intent of the test
angela-tran May 30, 2024
1d4eb88
fix(test): remove test that has been revealed to not be meaningful
angela-tran May 30, 2024
e7d42d3
CI: check for up-to-date migrations (#2122)
angela-tran May 30, 2024
6f9b651
chore(deps): bump mkdocs-material from 9.5.24 to 9.5.25 (#2124)
angela-tran May 30, 2024
bd15f2b
docs: remove remaining documentation referencing GitHub Webhooks
angela-tran May 30, 2024
7f75d0f
chore(deps): bump requests from 2.32.2 to 2.32.3 (#2126)
angela-tran May 31, 2024
8308d7b
Fix: test assertions for missing claim on AuthProvider (#2127)
angela-tran May 31, 2024
fc291ed
chore: reuse variable for status code
angela-tran Jun 3, 2024
8dc8e2a
chore(deps): bump dawidd6/action-download-artifact from 3 to 4
dependabot[bot] Jun 3, 2024
431cb24
chore(deps): bump dawidd6/action-download-artifact from 3 to 4 (#2130)
thekaveman Jun 3, 2024
9e06bc1
chore(compose): remove obsolete version key
thekaveman Jun 3, 2024
5b23480
ci: remove path filters from triggers
angela-tran Jun 4, 2024
7c20abd
Feat: server error - 400 errors / other exceptions during /token (#2117)
angela-tran Jun 4, 2024
d127498
Chore: remove obsolete Compose version key (#2131)
thekaveman Jun 4, 2024
b1bf8b4
Docs: deployment process to Azure Web App (#2128)
angela-tran Jun 4, 2024
30725eb
CI: remove path filters from migration check (#2132)
angela-tran Jun 4, 2024
a563e7e
Refactor: terraform app service deployment (#2123)
thekaveman Jun 4, 2024
4d72690
chore(deps): bump dawidd6/action-download-artifact from 4 to 5
dependabot[bot] Jun 4, 2024
8b56df4
chore(deps): bump dawidd6/action-download-artifact from 4 to 5 (#2133)
thekaveman Jun 4, 2024
a9a6493
Feat: `onError` shows error pages rather than retry (#2120)
angela-tran Jun 5, 2024
b5b561e
ci(codeql): guard against empty language array
thekaveman Jun 5, 2024
c0ff6f9
refactor: delete app setting meant for refreshing secrets
angela-tran Jun 4, 2024
d5a2114
CI: guard against empty language array for CodeQL runs (#2137)
thekaveman Jun 5, 2024
b9ed7eb
feat(analytics): add optional error_code event property
lalver1 May 29, 2024
e5056e3
feat(oauth): add optional error_code to authorize view
lalver1 May 29, 2024
fec172b
fix(ci): correct invalid syntax
thekaveman Jun 5, 2024
c10e577
fix(terraform): match config to state for source_control
thekaveman Jun 5, 2024
77c4981
fix(terraform): remove unused? app setting
thekaveman Jun 5, 2024
2e12047
feat(tests): add test for error in claim
lalver1 Jun 3, 2024
75cfeb0
feat(tests): add tests for FinishedSignInEvent
lalver1 Jun 4, 2024
5a3e2db
Fix: correct invalid syntax in CodeQL (#2140)
thekaveman Jun 6, 2024
8d7dc94
Refactor: delete app setting meant for refreshing secrets (#2138)
angela-tran Jun 6, 2024
20aeaa1
Fix: terraform source control block (#2141)
thekaveman Jun 6, 2024
55c8905
Feat: analytics for auth claims flow (#2125)
lalver1 Jun 6, 2024
cbd95cc
chore(deps-dev): bump cypress from 13.10.0 to 13.11.0 in /tests/cypress
dependabot[bot] Jun 4, 2024
943e459
chore(deps-dev): bump cypress from 13.10.0 to 13.11.0 in /tests/cypre…
thekaveman Jun 6, 2024
310c591
chore(deps): bump sentry-sdk from 2.1.1 to 2.4.0
dependabot[bot] Jun 4, 2024
c2d7453
fi(ci): correct invalid syntax
thekaveman Jun 6, 2024
2250cc8
chore(deps): bump sentry-sdk from 2.1.1 to 2.4.0 (#2135)
thekaveman Jun 6, 2024
6c33e11
chore(deps): bump authlib from 1.3.0 to 1.3.1
dependabot[bot] Jun 4, 2024
1b7aafb
chore(deps): bump sentry-sdk from 2.4.0 to 2.5.0
dependabot[bot] Jun 6, 2024
2286ef1
chore(deps): bump mkdocs-material from 9.5.25 to 9.5.26
dependabot[bot] Jun 6, 2024
1ff33e4
chore(deps): bump mkdocs-material from 9.5.25 to 9.5.26 (#2143)
thekaveman Jun 7, 2024
d1b5b19
chore(deps): bump sentry-sdk from 2.4.0 to 2.5.0 (#2142)
thekaveman Jun 7, 2024
cb52498
chore: qa spanish copy for agency card
lalver1 Jun 7, 2024
40ac52e
Chore: QA Spanish translations for agency card (#2144)
lalver1 Jun 7, 2024
7e44e59
chore(terraform): update pipeline version
thekaveman Jun 7, 2024
110e0b1
Chore: update Terraform version in pipeline (#2146)
thekaveman Jun 7, 2024
ffc07c2
chore(deps): bump calitp-littlepay from 2024.4.1 to 2024.6.1
dependabot[bot] Jun 7, 2024
a5354d2
chore(deps): bump authlib from 1.3.0 to 1.3.1 (#2134)
thekaveman Jun 7, 2024
18b7d1d
chore(deps): bump calitp-littlepay from 2024.4.1 to 2024.6.1 (#2147)
angela-tran Jun 7, 2024
2016887
chore: update version
lalver1 Jun 7, 2024
2feb724
Chore: update version (#2148)
lalver1 Jun 7, 2024
128a16d
refactor(tests): update eligibility type enrollment index template test
lalver1 Jun 10, 2024
f9568a1
feat: add a check for up-to-date Django message files
angela-tran Jun 10, 2024
74251f2
refactor: rename the workflow file
angela-tran Jun 10, 2024
798aa83
chore: rename the job
angela-tran Jun 10, 2024
13c9b03
Refactor(tests): Update eligibility type enrollment index template te…
lalver1 Jun 11, 2024
efcebc8
Feat: check makemessages (#2155)
angela-tran Jun 11, 2024
f6fafef
docs(logic): lay out the overview and initial flow
thekaveman Jun 4, 2024
e06741b
docs(logic): describe identity proofing phase
thekaveman Jun 4, 2024
32f63c8
docs(logic): describe eligibility verification phase
thekaveman Jun 4, 2024
eb0d23a
docs(logic): describe enrollment phase
thekaveman Jun 5, 2024
42657ce
docs(logic): outline Django request pipeline
thekaveman Jun 5, 2024
570c512
docs(logic): clarify Relaying Party definition
thekaveman Jun 10, 2024
a9d6281
docs(logic): add analytics events
thekaveman Jun 11, 2024
bcda49e
Docs: overview of the application logic (#2139)
thekaveman Jun 11, 2024
bc99c82
chore(deps): bump django-google-sso from 6.2.0 to 6.2.1
dependabot[bot] Jun 11, 2024
b46fc09
chore(deps): bump django-google-sso from 6.2.0 to 6.2.1 (#2150)
angela-tran Jun 11, 2024
4c09fee
refactor(container): move app root out of /home
thekaveman Jun 10, 2024
ccb62b2
Refactor: move the application directory up a level (#2156)
thekaveman Jun 12, 2024
b018c42
feat(dependabot): default PR status to In review
thekaveman Jun 11, 2024
db2d062
chore(deps): bump azure-identity from 1.16.0 to 1.16.1
dependabot[bot] Jun 11, 2024
c9f3fb6
chore(deps): bump azure-identity from 1.16.0 to 1.16.1 (#2157)
lalver1 Jun 12, 2024
f64f342
chore(deps): bump sentry-sdk from 2.5.0 to 2.5.1
dependabot[bot] Jun 12, 2024
44c097a
chore(deps): bump sentry-sdk from 2.5.0 to 2.5.1 (#2149)
lalver1 Jun 12, 2024
b4e9f44
refactor(oauth): move client registration to happen during view import
angela-tran Jun 10, 2024
c9e7494
refactor(oauth): change to approach of registering client in login view
angela-tran Jun 10, 2024
770f8e1
feat: ensure client is registered for authorize view
angela-tran Jun 12, 2024
f0670ef
Feat: default dependabot PR status to In review (#2158)
thekaveman Jun 12, 2024
08dcebe
chore(deps): bump dawidd6/action-download-artifact from 5 to 6
dependabot[bot] Jun 12, 2024
4d2e1ec
refactor(oauth): attempt to create client and register if needed
angela-tran Jun 12, 2024
0a246e1
chore(deps): bump dawidd6/action-download-artifact from 5 to 6 (#2161)
thekaveman Jun 12, 2024
ff98a62
fix(terraform): turn on manual integration
thekaveman Jun 12, 2024
f7951f7
fix(terraform): add container config block
thekaveman Jun 12, 2024
06186fa
docs(oauth): update details around client registration
angela-tran Jun 12, 2024
9556fe5
Refactor(oauth): resolve RuntimeWarning (#2152)
angela-tran Jun 12, 2024
61645c9
Fix: terraform source control block (#2160)
thekaveman Jun 13, 2024
b28fc6d
Revert "fix(terraform): turn on manual integration"
thekaveman Jun 13, 2024
76783a3
Revert "fix(terraform): turn on manual integration" (#2163)
thekaveman Jun 13, 2024
806fe02
fix(terraform): remove source control block
thekaveman Jun 13, 2024
fd633ad
Fix: remove source control block (#2164)
thekaveman Jun 13, 2024
4ed3c96
Roadmap updates
indexing Jun 13, 2024
76a5b1e
docs(infra): move Environments section up, move some sections under it
angela-tran Jun 12, 2024
7c863a8
docs(infra): content edits to sections under Environments
angela-tran Jun 12, 2024
e0cfaca
docs(infra): add introductory section
angela-tran Jun 12, 2024
5234ef8
docs(infra): content edits to sections about making changes
angela-tran Jun 12, 2024
d5c8d1c
chore: whitespace from formatter
angela-tran Jun 12, 2024
232a7f9
docs(infra): move some sections up one level
angela-tran Jun 12, 2024
7e81a18
Roadmap updates (#2162)
indexing Jun 13, 2024
64db833
Docs: clean up / reorganize Infrastructure documentation (#2159)
angela-tran Jun 13, 2024
6587a7d
feat(terraform): enable app service storage
thekaveman Jun 13, 2024
8eb0e3f
Feat: enable app service storage (#2166)
thekaveman Jun 13, 2024
3f234b2
fix: relax condition so that empty strings will also be filtered out
angela-tran Jun 14, 2024
31e1f31
Fix: verifier help templates (#2169)
angela-tran Jun 14, 2024
bb589e3
ci(dependencies): add pre-commit PRs to project
thekaveman Jun 17, 2024
4622990
CI: add pre-commit PRs to project (#2171)
thekaveman Jun 17, 2024
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dockerComposeFile": ["../compose.yml"],
"service": "dev",
"runServices": ["dev", "docs", "server"],
"workspaceFolder": "/home/calitp/app",
"workspaceFolder": "/calitp/app",
"postStartCommand": ["/bin/bash", "bin/reset_db.sh"],
"postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],
"customizations": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/postAttach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -eu

# initialize pre-commit

git config --global --add safe.directory /home/calitp/app
git config --global --add safe.directory /calitp/app
pre-commit install --overwrite
6 changes: 3 additions & 3 deletions .github/workflows/add-to-project-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
add-to-project-dependabot:
runs-on: ubuntu-latest
# see https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#responding-to-events
if: github.actor == 'dependabot[bot]'
if: github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]'
steps:
- uses: actions/add-to-project@main
with:
Expand All @@ -18,7 +18,7 @@ jobs:
- uses: EndBug/project-fields@v2
with:
operation: set
fields: Effort
values: 1
fields: Effort,Status
values: 1,In review
project_url: https://github.com/orgs/cal-itp/projects/${{ secrets.GH_PROJECT }}
github_token: ${{ secrets.GH_PROJECTS_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/check-migrations-and-messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check for up-to-date Django migrations and messages
on: [push, pull_request]

jobs:
check-migrations-and-messages:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install system packages
run: |
sudo apt-get update -y
sudo apt-get install -y gettext

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

- name: Install Python dependencies
run: pip install -e .[dev,test]

- name: Run ./bin/makemigrations.sh
run: |
if ./bin/makemigrations.sh | grep -q 'No changes detected';
then
exit 0;
else
exit 1;
fi

- name: Run ./bin/makemessages.sh
run: |
./bin/makemessages.sh

set -x # show commands

git add benefits

# message files are up-to-date if the only differences are from the updated timestamp
if echo $(git diff --cached --shortstat) | grep -q '2 files changed, 2 insertions(+), 2 deletions(-)';
then
exit 0;
else
exit 1;
fi
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
name: CodeQL Analyze
runs-on: ubuntu-latest
needs: setup
if: ${{ needs.setup.outputs.languages != '[]' }}
permissions:
actions: read
contents: read
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ jobs:
context: .
file: appcontainer/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:${{ github.sha }}
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}

- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
images: ghcr.io/${{ github.repository }}:${{ github.sha }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
uses: actions/checkout@v4

- name: Download coverage report
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v6
with:
workflow: tests-pytest.yml
branch: dev
Expand Down
2 changes: 1 addition & 1 deletion appcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN python -m pip install --upgrade pip

# overwrite default nginx.conf
COPY appcontainer/nginx.conf /etc/nginx/nginx.conf
COPY appcontainer/proxy.conf /home/calitp/run/proxy.conf
COPY appcontainer/proxy.conf /calitp/run/proxy.conf

# copy source files
COPY manage.py manage.py
Expand Down
8 changes: 4 additions & 4 deletions appcontainer/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ http {
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
server unix:/home/calitp/run/gunicorn.sock fail_timeout=0;
server unix:/calitp/run/gunicorn.sock fail_timeout=0;
}

# maps $binary_ip_address to $limit variable if request is of type POST
Expand Down Expand Up @@ -67,7 +67,7 @@ http {

# path for static files
location /static/ {
alias /home/calitp/app/static/;
alias /calitp/app/static/;
expires 1y;
add_header Cache-Control public;
}
Expand All @@ -81,12 +81,12 @@ http {
# case-insensitive regex matches path
location ~* ^/(eligibility/confirm)$ {
limit_req zone=rate_limit;
include /home/calitp/run/proxy.conf;
include /calitp/run/proxy.conf;
}

# app path
location @proxy_to_app {
include /home/calitp/run/proxy.conf;
include /calitp/run/proxy.conf;
}
}
}
2 changes: 1 addition & 1 deletion benefits/core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def unique_values(original_list):
def _agency_context(agency):
return {
"eligibility_index_url": agency.eligibility_index_url,
"help_templates": unique_values([v.help_template for v in agency.active_verifiers if v.help_template is not None]),
"help_templates": unique_values([v.help_template for v in agency.active_verifiers if v.help_template]),
"info_url": agency.info_url,
"long_name": agency.long_name,
"phone": agency.phone,
Expand Down
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
1 change: 1 addition & 0 deletions benefits/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ def to_url(self, agency):
path("<agency:agency>", views.agency_index, name="agency_index"),
path("<agency:agency>/publickey", views.agency_public_key, name="agency_public_key"),
path("logged_out", views.logged_out, name="logged_out"),
path("error", views.server_error, name="server-error"),
]
1 change: 1 addition & 0 deletions benefits/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ROUTE_ELIGIBILITY = "eligibility:index"
ROUTE_HELP = "core:help"
ROUTE_LOGGED_OUT = "core:logged_out"
ROUTE_SERVER_ERROR = "core:server-error"

TEMPLATE_INDEX = "core/index.html"
TEMPLATE_AGENCY = "core/agency-index.html"
Expand Down
14 changes: 14 additions & 0 deletions benefits/enrollment/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ def __init__(self, request, status, error=None, payment_group=None):
self.update_event_properties(payment_group=payment_group)


class FailedAccessTokenRequestEvent(core.Event):
"""Analytics event representing a failure to acquire an access token for card tokenization."""

def __init__(self, request, status_code=None):
super().__init__(request, "failed access token request")
if status_code is not None:
self.update_event_properties(status_code=status_code)


def returned_error(request, error):
"""Send the "returned enrollment" analytics event with an error status and message."""
core.send_event(ReturnedEnrollmentEvent(request, status="error", error=error))
Expand All @@ -29,3 +38,8 @@ def returned_retry(request):
def returned_success(request, payment_group):
"""Send the "returned enrollment" analytics event with a success status."""
core.send_event(ReturnedEnrollmentEvent(request, status="success", payment_group=payment_group))


def failed_access_token_request(request, status_code=None):
"""Send the "failed access token request" analytics event with the response status code."""
core.send_event(FailedAccessTokenRequestEvent(request, status_code=status_code))
4 changes: 2 additions & 2 deletions benefits/enrollment/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class CardTokenizeSuccessForm(forms.Form):
class CardTokenizeFailForm(forms.Form):
"""Form to indicate card tokenization failure to server."""

id = "form-card-tokenize-fail"
method = "POST"

def __init__(self, action_url, *args, **kwargs):
def __init__(self, action_url, id, *args, **kwargs):
# init super with an empty data dict
# binds and makes immutable this form's data
# since there are no form fields, the form is also marked as valid
super().__init__({}, *args, **kwargs)
self.id = id
self.action_url = action_url
13 changes: 12 additions & 1 deletion benefits/enrollment/templates/enrollment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ <h1 class="pb-lg-8 pb-4">
$.ajax({ dataType: "script", attrs: { nonce: "{{ request.csp_nonce }}"}, url: "{{ card_tokenize_url }}" })
.done(function() {
$.get("{{ access_token_url }}", function(data) {
if (data.redirect) {
// https://stackoverflow.com/a/42469170
// use 'assign' because 'replace' was giving strange Back button behavior
window.location.assign(data.redirect);
return; // exit early so the rest of this function doesn't execute
}

$(".loading").remove();
// remove invisible and add back visible, so we aren't left with
// a div with an empty class attribute
Expand Down Expand Up @@ -87,7 +94,11 @@ <h1 class="pb-lg-8 pb-4">
/* 400 or 500 will return. */
amplitude.getInstance().logEvent(closedEvent, {status: "error", error: response});

var form = $("form#{{ form_retry }}");
if (response.status >= 500) {
var form = $("form#{{ form_system_error }}");
} else {
var form = $("form#{{ form_server_error }}");
}
form.submit();
},
onCancel: function () {
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 %}
Loading
Loading