Skip to content

Commit

Permalink
In payments, make NO_TRANSACTION the only special transaction code
Browse files Browse the repository at this point in the history
trans_id > 0 is used to identify an authorize transaction in many places in the
code and trans_id < 0 is used to identify freebies, so for now the only
"special" code is 0

(Also fixes problem with mark_payment_error since ERROR wasn't in the Enum)
  • Loading branch information
shlurbee committed Jun 20, 2012
1 parent 963bbbc commit 26021af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions r2/r2/models/promo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
from r2.models import Link

PaymentState = Enum('UNPAID', 'PAID', 'FREEBIE')
TransactionCode = Enum('NEW', 'FREEBIE')

NO_TRANSACTION = 0

class PromoCampaign(Thing):

_defaults = dict(link_id=None,
sr_name='',
owner_id=None,
payment_state=PaymentState.UNPAID,
trans_id=TransactionCode.NEW,
trans_id=NO_TRANSACTION,
trans_error=None,
bid=None,
start_date=None,
Expand Down Expand Up @@ -65,7 +66,7 @@ def mark_freebie(self, trans_id):
self.payment_state = PaymentState.FREEBIE

def mark_payment_error(self, error_msg):
self.trans_id = TransactionCode.ERROR
self.trans_id = NO_TRANSACTION
self.trans_error = error_msg

def delete(self):
Expand Down

0 comments on commit 26021af

Please sign in to comment.