diff --git a/r2/r2/controllers/ipn.py b/r2/r2/controllers/ipn.py index 51c103cc2..4b874ed65 100644 --- a/r2/r2/controllers/ipn.py +++ b/r2/r2/controllers/ipn.py @@ -56,7 +56,7 @@ from r2.models import ( Account, account_by_payingid, account_from_stripe_customer_id, - accountid_from_paypalsubscription, + accountid_from_subscription, admintools, append_random_bottlecap_phrase, cancel_subscription, @@ -201,7 +201,7 @@ def existing_subscription(subscr_id, paying_id, custom): if subscr_id is None: return None - account_id = accountid_from_paypalsubscription(subscr_id) + account_id = accountid_from_subscription(subscr_id) if not account_id and has_blob(custom): # New subscription contains the user info in hardcache @@ -627,6 +627,11 @@ class IpnController(RedditController): # and "custom", just in case we need to debug it later or something secret = payment_blob['goldtype'] + "-" + custom + if payment_blob['goldtype'] == 'autorenew': + existing = existing_subscription(subscr_id, paying_id, custom) + if existing: + secret = None + if instagift: status="instagift" else: diff --git a/r2/r2/models/admintools.py b/r2/r2/models/admintools.py index 63aa20f68..c2e157073 100644 --- a/r2/r2/models/admintools.py +++ b/r2/r2/models/admintools.py @@ -247,7 +247,7 @@ def all_gold_users(): data=True, sort="_id") return fetch_things2(q) -def accountid_from_paypalsubscription(subscr_id): +def accountid_from_subscription(subscr_id): if subscr_id is None: return None