mirror of
https://github.com/simple-login/app.git
synced 2025-02-25 00:03:03 +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
13
server.py
13
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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue