Skip to content

Commit

Permalink
Make is_charged_transaction safer
Browse files Browse the repository at this point in the history
Returns False immediately if trans_id is 0 since this value means no record has
been created and therefore the transaction can't have been charged.
  • Loading branch information
shlurbee committed Jun 27, 2012
1 parent 6f9f91e commit fd4662a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions r2/r2/lib/authorize/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def void_transaction(user, trans_id, campaign, test = None):


def is_charged_transaction(trans_id, campaign):
if not trans_id: return False # trans_id == 0 means no bid
bid = Bid.one(transaction = trans_id, campaign = campaign)
return bid.is_charged()

Expand Down

0 comments on commit fd4662a

Please sign in to comment.