(customer_id: str, user_id: str)
| 210 | # so delete_account runs each of these through asyncio.to_thread. |
| 211 | |
| 212 | def _cancel_active_subscriptions(customer_id: str, user_id: str) -> None: |
| 213 | subscriptions = stripe.Subscription.list(customer=customer_id, status='all', limit=100) |
| 214 | for sub in subscriptions.data: |
| 215 | if sub.status in ('active', 'trialing'): |
| 216 | stripe.Subscription.cancel(sub.id) |
| 217 | logger.info(f"Cancelled Stripe subscription {sub.id} for user {user_id}") |
| 218 | |
| 219 | |
| 220 | def _redact_stripe_customers(email: str, user_id: str) -> None: |
no test coverage detected