This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Include campaign id in duplicate bid error handling

Uses both transaction id and campaign id to uniquely identify a bid. This
fixes a bug where querying for one bid in some cases caused a multiple rows
returned exception - a side effect of the campaign migration, which left both
old and new bids in the db.

This change also includes the campaign id when attempting to recreate a lost
bid record because... bid records are supposed to have campaign ids. I'm not
sure what was happening with the bid records that didn't.
  • Loading branch information...
shlurbee committed Jul 31, 2012
1 parent 47a6a88 commit d7000c283aa66097fae053053c5c3094df0872b9
Showing with 4 additions and 2 deletions.
  1. +4 −2 r2/r2/lib/authorize/interaction.py
@@ -134,10 +134,12 @@ def auth_transaction(amount, user, payid, thing, campaign, test = None):
# duplicate transaction, which is bad, but not horrible. Log
# the transaction id, creating a new bid if necessary.
elif (res.response_code, res.response_reason_code) == (3,11):
+ g.log.debug("Authorize.net duplicate trans %d on campaign %d" %
+ (res.trans_id, campaign))
try:
- Bid.one(res.trans_id)
+ Bid.one(res.trans_id, campaign=campaign)
except NotFound:
- Bid._new(res.trans_id, user, payid, thing._id, amount)
+ Bid._new(res.trans_id, user, payid, thing._id, amount, campaign)
return res.trans_id, res.response_reason_text

0 comments on commit d7000c2

Please sign in to comment.