feat: auto registration email with token link + Westside branding #36

Merged
forgejo_admin merged 1 commit from 35-auto-registration-email into main 2026-03-10 04:52:38 +00:00

Summary

After Stripe payment completes, the webhook handler now auto-generates a registration_token for the parent (if they don't already have one) and sends a branded confirmation email containing a "Complete Registration" link. The email uses Westside red/black branding instead of the old blue/gold scheme.

Changes

  • src/basketball_api/services/registration.py -- Added import secrets; after parent creation/lookup in process_checkout_completed(), generates registration_token via secrets.token_urlsafe(32) if the parent doesn't have one yet.
  • src/basketball_api/services/email.py -- Rewrote send_confirmation_email() to include a personalized registration link ({base_url}/register?token={token}). Replaced blue/gold HTML template with Westside red/black branding (#d42026, #0a0a0a, #141414, #f0f0f0, #a0a0a0). Extracted HTML rendering into _build_confirmation_html() helper for line-length compliance. Updated subject line to "Complete [Player]'s Tryout Registration". Added CTA button and fallback plain-text link.

Test Plan

  • Verify ruff check and ruff format pass (confirmed locally)
  • Verify Python imports succeed for both modified modules (confirmed locally)
  • Verify HTML template renders with all Westside brand colors, CTA button, token URL, payment badge, and no old blue/gold colors (confirmed locally)
  • CI pipeline will run full test suite (83 tests) against Postgres service container
  • Manual E2E: trigger a Stripe test checkout and confirm the email arrives with registration link and correct branding

Review Checklist

  • No new dependencies added
  • ruff check and ruff format pass
  • No secrets or credentials in diff
  • Registration token generation is idempotent (skips if parent already has one)
  • Email includes both HTML and plain-text body
  • Brand colors match src/basketball_api/brand.py constants
  • Subject line includes player name for personalization
  • CTA button links to /register?token=... with settings.base_url
  • Closes #35
  • Plan: plan-2026-03-08-tryout-prep
## Summary After Stripe payment completes, the webhook handler now auto-generates a `registration_token` for the parent (if they don't already have one) and sends a branded confirmation email containing a "Complete Registration" link. The email uses Westside red/black branding instead of the old blue/gold scheme. ## Changes - **`src/basketball_api/services/registration.py`** -- Added `import secrets`; after parent creation/lookup in `process_checkout_completed()`, generates `registration_token` via `secrets.token_urlsafe(32)` if the parent doesn't have one yet. - **`src/basketball_api/services/email.py`** -- Rewrote `send_confirmation_email()` to include a personalized registration link (`{base_url}/register?token={token}`). Replaced blue/gold HTML template with Westside red/black branding (`#d42026`, `#0a0a0a`, `#141414`, `#f0f0f0`, `#a0a0a0`). Extracted HTML rendering into `_build_confirmation_html()` helper for line-length compliance. Updated subject line to "Complete [Player]'s Tryout Registration". Added CTA button and fallback plain-text link. ## Test Plan - Verify `ruff check` and `ruff format` pass (confirmed locally) - Verify Python imports succeed for both modified modules (confirmed locally) - Verify HTML template renders with all Westside brand colors, CTA button, token URL, payment badge, and no old blue/gold colors (confirmed locally) - CI pipeline will run full test suite (83 tests) against Postgres service container - Manual E2E: trigger a Stripe test checkout and confirm the email arrives with registration link and correct branding ## Review Checklist - [x] No new dependencies added - [x] `ruff check` and `ruff format` pass - [x] No secrets or credentials in diff - [x] Registration token generation is idempotent (skips if parent already has one) - [x] Email includes both HTML and plain-text body - [x] Brand colors match `src/basketball_api/brand.py` constants - [x] Subject line includes player name for personalization - [x] CTA button links to `/register?token=...` with `settings.base_url` ## Related - Closes #35 - Plan: `plan-2026-03-08-tryout-prep`
feat: auto registration email with token link + Westside branding
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
b9022808c7
- Generate registration_token for parent on Stripe checkout completion
- Update confirmation email with registration link and red/black branding
- Email sends automatically after payment via webhook

Closes #35

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
forgejo_admin force-pushed 35-auto-registration-email from b9022808c7
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to 59ede91e9b
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2026-03-10 04:52:31 +00:00
Compare
forgejo_admin deleted branch 35-auto-registration-email 2026-03-10 04:52:38 +00:00
Sign in to join this conversation.
No description provided.