From d23ee7ab9859f0849d25e1952b7f04219944738e Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Mon, 28 Apr 2014 10:06:27 -0400 Subject: [PATCH] Retrieve deleted users with paypal gold subscriptions. They won't get any gold but the event is logged so the subscription can be deleted. Respond to paypal's IPN with a 200 rather than raising an exception so the IPN isn't retried. --- r2/r2/controllers/ipn.py | 4 ++-- r2/r2/models/admintools.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/r2/r2/controllers/ipn.py b/r2/r2/controllers/ipn.py index 77b48ef74..e50c4865a 100644 --- a/r2/r2/controllers/ipn.py +++ b/r2/r2/controllers/ipn.py @@ -196,8 +196,8 @@ def existing_subscription(subscr_id, paying_id, custom): account = Account._byID(account_id, data=True) if account._deleted: - g.log.info("Just got IPN renewal for deleted account #%d" - % account_id) + g.log.info("IPN renewal for deleted account %d (%s)", account_id, + subscr_id) return "deleted account" if should_set_subscriber: diff --git a/r2/r2/models/admintools.py b/r2/r2/models/admintools.py index 000e5b874..e0a1fdd40 100644 --- a/r2/r2/models/admintools.py +++ b/r2/r2/models/admintools.py @@ -237,7 +237,8 @@ def accountid_from_paypalsubscription(subscr_id): return None q = Account._query(Account.c.gold_subscr_id == subscr_id, - Account.c._spam == (True, False), data=False) + Account.c._spam == (True, False), + Account.c._deleted == (True, False), data=False) l = list(q) if l: return l[0]._id