app-MAIL-temp/cron.py
Son NK 263f68ecec Change subscription model
- create subscription table
- rename plan_expiration -> trial_expiration
- remove user.plan, user.promo_codes
2019-12-15 18:55:13 +02:00

21 lines
485 B
Python

import arrow
from app.log import LOG
from app.models import Subscription
from server import create_app
def late_payment():
"""check for late payment
"""
for sub in Subscription.query.all():
if (not sub.cancelled) and sub.next_bill_date < arrow.now():
LOG.error(f"user {sub.user.email} has late payment. {sub}")
if __name__ == "__main__":
LOG.d("Start running cronjob")
app = create_app()
with app.app_context():
late_payment()