From bada1869621fbe33ea81504ead11e44ca47da843 Mon Sep 17 00:00:00 2001 From: Son NK Date: Sun, 8 Mar 2020 11:38:45 +0100 Subject: [PATCH] Log more info on cancel event --- server.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 268ac2b4..598a3467 100644 --- a/server.py +++ b/server.py @@ -394,12 +394,23 @@ def setup_paddle_callback(app: Flask): elif request.form.get("alert_name") == "subscription_cancelled": subscription_id = request.form.get("subscription_id") - LOG.warning("Cancel subscription %s", subscription_id) sub: Subscription = Subscription.get_by(subscription_id=subscription_id) if sub: + # cancellation_effective_date should be the same as next_bill_date + LOG.error( + "Cancel subscription %s %s on %s, next bill date %s", + subscription_id, + sub.user, + request.form.get("cancellation_effective_date"), + sub.next_bill_date + ) + sub.event_time = arrow.now() + sub.cancelled = True db.session.commit() + else: + return "No such subscription", 400 return "OK" @@ -425,7 +436,7 @@ def setup_do_not_track(app): def do_not_track(): return """ - +