notify user with premium plan ending soon
This commit is contained in:
parent
3492935f95
commit
52f364d73b
29
cron.py
29
cron.py
|
@ -30,6 +30,25 @@ def notify_trial_end():
|
||||||
send_trial_end_soon_email(user)
|
send_trial_end_soon_email(user)
|
||||||
|
|
||||||
|
|
||||||
|
def notify_premium_end():
|
||||||
|
"""sent to user who has canceled their subscription and who has their subscription ending soon"""
|
||||||
|
for sub in Subscription.query.filter(Subscription.cancelled == True).all():
|
||||||
|
if (
|
||||||
|
arrow.now().shift(days=3).date()
|
||||||
|
> sub.next_bill_date
|
||||||
|
>= arrow.now().shift(days=2).date()
|
||||||
|
):
|
||||||
|
user = sub.user
|
||||||
|
LOG.d(f"Send subscription ending soon email to user {user}")
|
||||||
|
|
||||||
|
send_email(
|
||||||
|
user.email,
|
||||||
|
f"Your subscription will end soon {user.name}",
|
||||||
|
render("transactional/subscription-end.txt", user=user),
|
||||||
|
render("transactional/subscription-end.html", user=user),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def notify_manual_sub_end():
|
def notify_manual_sub_end():
|
||||||
for manual_sub in ManualSubscription.query.all():
|
for manual_sub in ManualSubscription.query.all():
|
||||||
need_reminder = False
|
need_reminder = False
|
||||||
|
@ -148,7 +167,12 @@ if __name__ == "__main__":
|
||||||
"--job",
|
"--job",
|
||||||
help="Choose a cron job to run",
|
help="Choose a cron job to run",
|
||||||
type=str,
|
type=str,
|
||||||
choices=["stats", "notify_trial_end", "notify_manual_subscription_end"],
|
choices=[
|
||||||
|
"stats",
|
||||||
|
"notify_trial_end",
|
||||||
|
"notify_manual_subscription_end",
|
||||||
|
"notify_premium_end",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -164,3 +188,6 @@ if __name__ == "__main__":
|
||||||
elif args.job == "notify_manual_subscription_end":
|
elif args.job == "notify_manual_subscription_end":
|
||||||
LOG.d("Notify users with manual subscription ending soon")
|
LOG.d("Notify users with manual subscription ending soon")
|
||||||
notify_manual_sub_end()
|
notify_manual_sub_end()
|
||||||
|
elif args.job == "notify_premium_end":
|
||||||
|
LOG.d("Notify users with premium ending soon")
|
||||||
|
notify_premium_end()
|
||||||
|
|
|
@ -16,3 +16,9 @@ jobs:
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
schedule: "0 9 * * *"
|
schedule: "0 9 * * *"
|
||||||
captureStderr: true
|
captureStderr: true
|
||||||
|
|
||||||
|
- name: SimpleLogin Notify Premium Ends
|
||||||
|
command: python /code/cron.py -j notify_premium_end
|
||||||
|
shell: /bin/bash
|
||||||
|
schedule: "0 10 * * *"
|
||||||
|
captureStderr: true
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if name %}
|
||||||
|
{{ render_text("Hi " + user.name + ",") }}
|
||||||
|
{% else %}
|
||||||
|
{{ render_text("Hi,") }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ render_text("Your subscription will end on " + user.next_bill_date() + ".") }}
|
||||||
|
|
||||||
|
{{ render_text("When the subscription ends:") }}
|
||||||
|
|
||||||
|
{{ render_text("- All aliases/domains/directories you have created are <b>kept</b> and continue working normally.") }}
|
||||||
|
{{ render_text("- You cannot create new aliases if you exceed the free plan limit, i.e. have more than 5 aliases.") }}
|
||||||
|
{{ render_text("- As features like <b>catch-all</b> or <b>directory</b> allow you to create aliases on-the-fly, those aliases cannot be automatically created if you have more than 5 aliases.") }}
|
||||||
|
{{ render_text("- You cannot add new domain or directory.") }}
|
||||||
|
|
||||||
|
{{ render_text('You can upgrade today to continue using all these Premium features (and much more coming).') }}
|
||||||
|
|
||||||
|
{{ render_button("Upgrade your account", "https://app.simplelogin.io/dashboard/pricing") }}
|
||||||
|
|
||||||
|
{{ render_text('Regardless of your choice, we want to say thank you for trying SimpleLogin. We know the product
|
||||||
|
requires an investment of your time, and we appreciate you giving us a chance.') }}
|
||||||
|
{{ render_text('Thanks, <br />SimpleLogin Team.') }}
|
||||||
|
{{ render_text('P.S. If you have any questions or need any help, please don\'t hesitate to reach out. You can simply reply to this email or reach us via Twitter/Github.') }}
|
||||||
|
{{ raw_url("https://app.simplelogin.io/dashboard/pricing") }}
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
Hi {{user.name}}
|
||||||
|
|
||||||
|
Your subscription will end on {{ user.next_bill_date() }}.
|
||||||
|
|
||||||
|
When the subscription ends:
|
||||||
|
|
||||||
|
- All aliases/domains/directories you have created are kept and continue working.
|
||||||
|
- You cannot create new aliases if you exceed the free plan limit, i.e. have more than 5 aliases.
|
||||||
|
- As features like "catch-all" or "directory" allow you to create aliases on-the-fly, those aliases cannot be automatically created if you have more than 5 aliases.
|
||||||
|
- You cannot add new domain or directory.
|
||||||
|
|
||||||
|
You can upgrade today to continue using all these Premium features (and much more coming).
|
||||||
|
|
||||||
|
Best,
|
||||||
|
SimpleLogin Team.
|
Loading…
Reference in New Issue