First monthly payment email + Stripe checkout for signed contracts #366
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#366
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — scoped during 2026-04-06 session. Prorated first payment is due per signed contracts. Spec and plan written in pal-e-platform.
Repo
forgejo_admin/basketball-apiUser Story
As a parent who signed a Westside contract
I want to receive an email with a one-click payment link
So that I can pay my prorated first monthly fee before the first practice
Context
First practice is April 7 (Tuesday). Contracts specify a prorated first monthly fee due around April 6-8. Each player has a per-player
monthly_feestored on the Player model ($200 standard, $180 LCA, $160 girls/Cyprus). The proration formula isround(fee * 25/30 / 5) * 5, matching the formula in westside-contracts+page.svelte:9.The approach is a direct API redirect: parent clicks CTA in email →
GET /checkout/first-payment?token={contract_token}→ endpoint creates Stripe Checkout Session → 302 redirect to Stripe hosted page → webhook marks Order paid. No frontend intermediary page needed.Email tone: friendly-firm (Marcus voice). "First practice tomorrow, here's what's due."
File Targets
Files to create:
alembic/versions/031_add_monthly_category_and_first_payment_email.py— migration: enum values + product seedtests/test_first_payment.py— checkout endpoint teststests/test_first_payment_email.py— email function teststests/test_first_payment_blast.py— blast endpoint testsFiles to modify:
src/basketball_api/models.py— addmonthlyto ProductCategory,first_paymentto EmailTypesrc/basketball_api/routes/checkout.py— addGET /checkout/first-paymentendpointsrc/basketball_api/services/email.py— addsend_first_payment_email()src/basketball_api/routes/admin.py— addPOST /admin/email/first-paymentblast endpointFiles NOT to touch:
src/basketball_api/routes/webhooks.py— existing_handle_generic_order_completedalready handles thissrc/basketball_api/routes/subscriptions.py��� recurring subscriptions are out of scopeAcceptance Criteria
monthlyProductCategory,first_paymentEmailType, seeds "Monthly Fee — Prorated April" productGET /checkout/first-payment?token={contract_token}returns 302 redirect to Stripe Checkoutsend_first_payment_email()produces branded HTML with player name, prorated amount, and checkout CTAPOST /admin/email/first-paymentsends to allcontract_status=signedplayerstest_emailparam on blast endpoint restricts to one parentemail_type=first_paymentTest Expectations
pytest tests/test_first_payment.py tests/test_first_payment_email.py tests/test_first_payment_blast.py -vConstraints
_brand_wrapper()pattern for branded HTMLcontract_token(Player model) notregistration_token(Parent model){base_url}/checkout/first-payment?token=X(API, not frontend_url)-lock=falseif any tofu commands needed (N/A for this ticket)Checklist
Related
westside-basketball— project this affects~/pal-e-platform/docs/superpowers/specs/2026-04-06-first-payment-email-design.md~/pal-e-platform/docs/superpowers/plans/2026-04-06-first-payment-email.mdScope Review: NEEDS_REFINEMENT
Review note:
review-872-2026-04-06Well-scoped feature with all template sections present, verified file targets, and concrete AC -- but too large for a single agent pass.
arch-basketball-apiandarch-emaildo not exist in pal-e-docs. Create them.skill-decompose-ticketfor 3-ticket split: (A) migration+models, (B) checkout endpoint+tests, (C) email+blast+tests. A is prerequisite; B and C can parallelize.