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