fix(billing): handle customer.subscription.created webhook + test isolation

- Add customer.subscription.created → subscription.activated mapping in
  stripe.parse_webhook so direct API subscription creation also creates DB rows
- Add customer.subscription.created to setup_stripe.py enabled_events
- Pin PAYMENT_PROVIDER=paddle and STRIPE_WEBHOOK_SECRET="" in test conftest
  so billing tests don't hit real Stripe API when env has Stripe keys
- Add 8 unit tests for stripe.parse_webhook covering all event types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-03-03 17:29:13 +01:00
parent 7c5fa86fb8
commit 72c4de91b0
4 changed files with 119 additions and 1 deletions

View File

@@ -213,8 +213,10 @@ def patch_config():
"""Set test Paddle config values."""
original_values = {}
test_values = {
"PAYMENT_PROVIDER": "paddle", # default to Paddle so mocks work
"PADDLE_API_KEY": "test_api_key_123",
"PADDLE_WEBHOOK_SECRET": "whsec_test_secret",
"STRIPE_WEBHOOK_SECRET": "", # no Stripe in default tests
"RESEND_API_KEY": "", # never send real emails in tests
"BASE_URL": "http://localhost:5000",
"DEBUG": True,