Stripe checkout #104411

Merged
Anna Sirota merged 61 commits from stripe into main 2024-06-17 18:08:41 +02:00
Showing only changes of commit 06157b6a77 - Show all commits

View File

@ -111,8 +111,7 @@ def _on_subscription_status_activated(sender: looper.models.Subscription, **kwar
@receiver(looper.signals.subscription_expired)
def _on_subscription_status_deactivated(sender: looper.models.Subscription, **kwargs):
# No other active subscription exists, subscriber badge can be revoked
customer = sender.customer
user = customer.user
user = sender.customer.user
if user and not queries.has_active_subscription(user):
users.tasks.revoke_blender_id_role(pk=user.pk, role='cloud_subscriber')
@ -152,8 +151,7 @@ def _on_subscription_expired(sender: looper.models.Subscription, **kwargs):
assert sender.status == 'expired', f'Expected expired, got "{sender.status} (pk={sender.pk})"'
# Only send a "subscription expired" email when there are no other active subscriptions
customer = sender.customer
user = customer.user
user = sender.customer.user
if user and not queries.has_active_subscription(user):
tasks.send_mail_subscription_expired(subscription_id=sender.pk)