mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-23 05:48:11 -05:00
Account for no secret in reverse_gold_purchase
Secret was removed for recurring Stripe calls. To see if it's a recurring subscription, we can see if a subscr_id exists.
This commit is contained in:
@@ -1358,13 +1358,17 @@ def reverse_gold_purchase(transaction_id):
|
||||
days = transaction.days
|
||||
months = days / 31
|
||||
|
||||
secret = transaction.secret
|
||||
if '{' in secret:
|
||||
secret.strip('{}') # I goofed
|
||||
pieces = secret.split(',')
|
||||
if transaction.subscr_id:
|
||||
goldtype = 'autorenew'
|
||||
else:
|
||||
pieces = secret.split('-')
|
||||
goldtype = pieces[0]
|
||||
secret = transaction.secret
|
||||
if '{' in secret:
|
||||
secret.strip('{}') # I goofed
|
||||
pieces = secret.split(',')
|
||||
else:
|
||||
pieces = secret.split('-')
|
||||
goldtype = pieces[0]
|
||||
|
||||
if goldtype == 'gift':
|
||||
recipient_name, secret = pieces[1:]
|
||||
recipient = Account._by_name(recipient_name)
|
||||
|
||||
Reference in New Issue
Block a user