mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
Hook fires on each new charge, not once for entire charge_pending.
This commit is contained in:
@@ -568,10 +568,18 @@ def charge_pending(offset=1):
|
||||
for l, camp, weight in accepted_campaigns(offset=offset):
|
||||
user = Account._byID(l.author_id)
|
||||
try:
|
||||
if (authorize.is_charged_transaction(camp.trans_id, camp._id) or not
|
||||
authorize.charge_transaction(user, camp.trans_id, camp._id)):
|
||||
if authorize.is_charged_transaction(camp.trans_id, camp._id):
|
||||
# already charged
|
||||
continue
|
||||
|
||||
charge_succeeded = authorize.charge_transaction(user, camp.trans_id,
|
||||
camp._id)
|
||||
|
||||
if not charge_succeeded:
|
||||
continue
|
||||
|
||||
hooks.get_hook('promote.new_charge').call(link=l, campaign=camp)
|
||||
|
||||
if is_promoted(l):
|
||||
emailer.queue_promo(l, camp.bid, camp.trans_id)
|
||||
else:
|
||||
@@ -583,8 +591,6 @@ def charge_pending(offset=1):
|
||||
except:
|
||||
print "Error on %s, campaign %s" % (l, camp._id)
|
||||
|
||||
hooks.get_hook('promote.charge_pending').call(offset=offset)
|
||||
|
||||
|
||||
def scheduled_campaigns_by_link(l, date=None):
|
||||
# A promotion/campaign is scheduled/live if it's in
|
||||
|
||||
Reference in New Issue
Block a user