diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-12 20:26:58 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-12 20:26:58 -0500 |
| commit | 61632862367416dc5154af536a7a4a4e7751d9a6 (patch) | |
| tree | b655b2199422db5e18e1c990f9bee61c6999f4bb /Biz/PodcastItLater | |
| parent | 9394a859af58c1ffc10190d43b19832c9b8d026b (diff) | |
Update webhook test to match real Stripe API behavior
- Use billing_cycle_anchor instead of current_period_start/end in test
- Reflects actual Stripe API v2025-10-29 subscription structure -
Test validates upgrade flow works with newer API versions - Removes
debug logging (list of available keys)
Diffstat (limited to 'Biz/PodcastItLater')
| -rw-r--r-- | Biz/PodcastItLater/Billing.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Biz/PodcastItLater/Billing.py b/Biz/PodcastItLater/Billing.py index 9664b9f..de3540b 100644 --- a/Biz/PodcastItLater/Billing.py +++ b/Biz/PodcastItLater/Billing.py @@ -381,9 +381,8 @@ def _update_subscription_state(subscription: dict[str, typing.Any]) -> None: if not period_start_ts: logger.warning( - "Missing period start in subscription: %s. Available keys: %s", + "Missing period start in subscription: %s", subscription_id, - list(subscription.keys()), ) return @@ -505,12 +504,12 @@ class TestWebhookHandling(Test.TestCase): self.assertEqual(user["stripe_customer_id"], "cus_test123") # Step 2: Handle customer.subscription.created + # (newer API uses billing_cycle_anchor instead of current_period_*) subscription = { "id": "sub_test123", "customer": "cus_test123", "status": "active", - "current_period_start": 1700000000, - "current_period_end": 1702592000, + "billing_cycle_anchor": 1700000000, "cancel_at_period_end": False, "items": { "data": [ |
