Reconcile orders table with minted Stripe Payment Links + add May Monthly product #517

Open
opened 2026-05-08 04:55:33 +00:00 by forgejo_admin · 0 comments
Contributor

Type

Feature

Lineage

Standalone — discovered during 2026-05-07 payment report generation. 51 Payment Links were minted manually via Stripe API but have no corresponding order rows in the database.

Repo

ldraney/basketball-api

User Story

As Coach Marcus
I want every outstanding fee to have a corresponding order in the database with a permanent payment link
So that I can resend payment reminders to parents on demand without manually minting links each time

Context

On 2026-05-07, a full roster payment audit revealed 25 of 31 signed players owe money ($6,915 total). 51 Stripe Payment Links were minted — all verified active and permanent — but most have no corresponding order in the database. Additionally ~190 duplicate links were created during context resets and should be deactivated.

Current gaps:

  • 5 players have ZERO orders: Creed Draney Jr (182), Gideon Odejinmi (114), Katie Kishpaugh (185), Kelsie Stevens (190), Zayvion Brown (132)
  • 9 players have tournament/jersey orders but NO monthly: Anaiyah Fesolai (96), Daniel Bryan Niyitanga (108), Gracie Maloney-Holland (117), Jacelyn Laila Bronson (97), Miran Berzan Akbas (93), Owence Ethan-Allen-Bully (90), Romial strachan (95), Sophie Furse (107), Yussuf Duro (116)
  • 3 players have pending monthly with existing links: David Kaneko (99), Elson (104), Vince Ifote (189)
  • 3 canceled-sub players owe May only: Jahzmyn Mailei (133), Marie Angilau-Lea (192), Querenne Nyamuhebe (119)
  • No "May Monthly Fee" product exists in the products table
  • Latest migration slot: 047 (next available: 048)

The 51 verified links are queryable from Stripe API via payment_links?limit=100 filtering by metadata.player_id. The last batch has full metadata; older tournament links have player_id only.

File Targets

  • src/basketball_api/models.py — no schema change needed, but seed the May Monthly product
  • src/basketball_api/services/monthly_checkout.py — review for order creation patterns
  • src/basketball_api/routes/admin.py — potential admin endpoint for link management
  • alembic/versions/048_*.py — data migration to create May product + insert missing orders with payment link URLs

Acceptance Criteria

  • "May Monthly Fee" product exists (category=monthly, type=one_time, price_cents=0)
  • All 14 players missing April prorated monthly orders have one with correct amount_cents and stripe_checkout_url
  • All 21 players owing May monthly have an order with correct amount_cents and stripe_checkout_url
  • Romial strachan (95) has a jersey order ($130) with stripe_checkout_url
  • All 51 report links map to exactly one order row each
  • Duplicate Payment Links (~190) deactivated in Stripe via API
  • subscription_status for Jahzmyn Mailei, Marie Angilau-Lea, Querenne Nyamuhebe verified against Stripe

Test Expectations

  • Migration runs cleanly: alembic upgrade head
  • Query SELECT count(*) FROM orders WHERE stripe_checkout_url LIKE 'https://buy.stripe.com/%' returns >= 51
  • No duplicate orders per player per product category per month
  • Run command: alembic upgrade head && pytest tests/ -k order

Constraints

  • Never write to prod DB directly — all changes via alembic migration
  • Payment Link URLs must be hardcoded in migration (sourced from /tmp/final_complete_report.txt or re-queried from Stripe API by player_id metadata)
  • Match existing order creation patterns in monthly_checkout.py
  • tenant_id = 1 (Westside) for all new orders

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • Migration tested locally via Docker Compose
  • project-westside-basketball — project this affects
  • Future: admin endpoint to mint + store payment links on demand, resend reminder endpoint, Payment Link completion webhook
### Type Feature ### Lineage Standalone — discovered during 2026-05-07 payment report generation. 51 Payment Links were minted manually via Stripe API but have no corresponding order rows in the database. ### Repo `ldraney/basketball-api` ### User Story As Coach Marcus I want every outstanding fee to have a corresponding order in the database with a permanent payment link So that I can resend payment reminders to parents on demand without manually minting links each time ### Context On 2026-05-07, a full roster payment audit revealed 25 of 31 signed players owe money ($6,915 total). 51 Stripe Payment Links were minted — all verified active and permanent — but most have no corresponding order in the database. Additionally ~190 duplicate links were created during context resets and should be deactivated. Current gaps: - 5 players have ZERO orders: Creed Draney Jr (182), Gideon Odejinmi (114), Katie Kishpaugh (185), Kelsie Stevens (190), Zayvion Brown (132) - 9 players have tournament/jersey orders but NO monthly: Anaiyah Fesolai (96), Daniel Bryan Niyitanga (108), Gracie Maloney-Holland (117), Jacelyn Laila Bronson (97), Miran Berzan Akbas (93), Owence Ethan-Allen-Bully (90), Romial strachan (95), Sophie Furse (107), Yussuf Duro (116) - 3 players have pending monthly with existing links: David Kaneko (99), Elson (104), Vince Ifote (189) - 3 canceled-sub players owe May only: Jahzmyn Mailei (133), Marie Angilau-Lea (192), Querenne Nyamuhebe (119) - No "May Monthly Fee" product exists in the products table - Latest migration slot: 047 (next available: 048) The 51 verified links are queryable from Stripe API via `payment_links?limit=100` filtering by `metadata.player_id`. The last batch has full metadata; older tournament links have player_id only. ### File Targets - `src/basketball_api/models.py` — no schema change needed, but seed the May Monthly product - `src/basketball_api/services/monthly_checkout.py` — review for order creation patterns - `src/basketball_api/routes/admin.py` — potential admin endpoint for link management - `alembic/versions/048_*.py` — data migration to create May product + insert missing orders with payment link URLs ### Acceptance Criteria - [ ] "May Monthly Fee" product exists (category=monthly, type=one_time, price_cents=0) - [ ] All 14 players missing April prorated monthly orders have one with correct amount_cents and stripe_checkout_url - [ ] All 21 players owing May monthly have an order with correct amount_cents and stripe_checkout_url - [ ] Romial strachan (95) has a jersey order ($130) with stripe_checkout_url - [ ] All 51 report links map to exactly one order row each - [ ] Duplicate Payment Links (~190) deactivated in Stripe via API - [ ] subscription_status for Jahzmyn Mailei, Marie Angilau-Lea, Querenne Nyamuhebe verified against Stripe ### Test Expectations - [ ] Migration runs cleanly: `alembic upgrade head` - [ ] Query `SELECT count(*) FROM orders WHERE stripe_checkout_url LIKE 'https://buy.stripe.com/%'` returns >= 51 - [ ] No duplicate orders per player per product category per month - Run command: `alembic upgrade head && pytest tests/ -k order` ### Constraints - Never write to prod DB directly — all changes via alembic migration - Payment Link URLs must be hardcoded in migration (sourced from /tmp/final_complete_report.txt or re-queried from Stripe API by player_id metadata) - Match existing order creation patterns in `monthly_checkout.py` - tenant_id = 1 (Westside) for all new orders ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes - [ ] Migration tested locally via Docker Compose ### Related - `project-westside-basketball` — project this affects - Future: admin endpoint to mint + store payment links on demand, resend reminder endpoint, Payment Link completion webhook
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/basketball-api#517
No description provided.