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 bb45dda51f - Show all commits

View File

@ -19,7 +19,7 @@ def has_active_subscription(user: User) -> bool:
active_subscriptions: 'QuerySet[Subscription]' = Subscription.objects.active() active_subscriptions: 'QuerySet[Subscription]' = Subscription.objects.active()
return active_subscriptions.filter( return active_subscriptions.filter(
Q(customer__user_id=user.id) | Q(team__team_users__user_id=user.id) Q(customer=user.customer) | Q(team__team_users__user_id=user.id)
).exists() ).exists()
@ -34,7 +34,7 @@ def has_non_legacy_subscription(user: User) -> bool:
subscriptions: 'QuerySet[Subscription]' = Subscription.objects.filter(is_legacy=False) subscriptions: 'QuerySet[Subscription]' = Subscription.objects.filter(is_legacy=False)
return subscriptions.filter( return subscriptions.filter(
Q(customer__user_id=user.id) | Q(team__team_users__user_id=user.id) Q(customer=user.customer) | Q(team__team_users__user_id=user.id)
).exists() ).exists()
@ -44,7 +44,7 @@ def has_subscription(user: User) -> bool:
return False return False
return Subscription.objects.filter( return Subscription.objects.filter(
Q(customer__user_id=user.id) | Q(team__team_users__user_id=user.id) Q(customer=user.customer) | Q(team__team_users__user_id=user.id)
).exists() ).exists()
@ -79,4 +79,4 @@ def has_not_yet_cancelled_subscription(user: User) -> bool:
status__in=Subscription._CANCELLED_STATUSES status__in=Subscription._CANCELLED_STATUSES
) )
return not_yet_cancelled_subscriptions.filter(Q(customer__user_id=user.id)).exists() return not_yet_cancelled_subscriptions.filter(Q(customer=user.customer)).exists()