Skip to content

Commit

Permalink
fix: gracefuly handle subscriptions without a payment
Browse files Browse the repository at this point in the history
Fixes WEBSITE-3R
  • Loading branch information
nijel committed Jan 23, 2025
1 parent d9b69a5 commit 8282ae7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions weblate_web/management/commands/recurring_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ def notify_expiry(weekday=0):
expires__lte=expires_notify, enabled=True
).exclude(payment=None)
for subscription in subscriptions:
payment = subscription.payment_obj
# Skip one-time payments and the ones with recurrence configured
if not subscription.package.get_repeat():
continue
try:
payment = subscription.payment_obj
except Payment.DoesNotExist:
payment = None
notify_user = (
payment_notify_start <= subscription.expires <= payment_notify_end
)
if payment.recurring:
if payment is None or payment.recurring:
if notify_user:
subscription.send_notification("payment_upcoming")
continue
Expand Down

0 comments on commit 8282ae7

Please sign in to comment.