Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

In payments, make NO_TRANSACTION the only special transaction code

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...
commit 26021aff5c01436647f1e765b62be9ad6925bb2d 1 parent 963bbbc
@shlurbee shlurbee authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 r2/r2/models/promo.py
View
7 r2/r2/models/promo.py
@@ -25,7 +25,8 @@
from r2.models import Link
PaymentState = Enum('UNPAID', 'PAID', 'FREEBIE')
-TransactionCode = Enum('NEW', 'FREEBIE')
+
+NO_TRANSACTION = 0
class PromoCampaign(Thing):
@@ -33,7 +34,7 @@ class PromoCampaign(Thing):
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,
@@ -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):
Please sign in to comment.
Something went wrong with that request. Please try again.