mirror of
https://github.com/simple-login/app.git
synced 2024-11-10 17:35:27 +08:00
Log more info on cancel event
This commit is contained in:
parent
84f3d7c278
commit
bada186962
1 changed files with 13 additions and 2 deletions
15
server.py
15
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 """
|
||||
<script src="/static/local-storage-polyfill.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
// Disable GoatCounter if this script is called
|
||||
|
||||
|
|
Loading…
Reference in a new issue