Skip to content

Commit

Permalink
fix: unsubscribe only if subscribed
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Jan 25, 2024
1 parent 13355dc commit 5d1b03e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bd_api/apps/payment/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def subscribe(event: Event, **kwargs):
@webhooks.handler("customer.subscription.deleted")
def unsubscribe(event: Event, **kwargs):
"""Remove customer from allowed google groups"""
subscription = get_subscription(event)
remove_user(event.customer.email)
subscription.is_active = False
subscription.save()
if subscription := get_subscription(event):
remove_user(event.customer.email)
subscription.is_active = False
subscription.save()


# Reference
Expand Down

0 comments on commit 5d1b03e

Please sign in to comment.