Skip to content

Commit

Permalink
edited admin
Browse files Browse the repository at this point in the history
  • Loading branch information
ParadoxZero committed Feb 13, 2018
1 parent de1158b commit ff1c702
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ritu18/apps/registration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TransactionStatus:
}

name = models.CharField(max_length=255)
transaction_id = models.CharField(max_length=255, null=True)
phone = models.CharField(max_length=14)
email = models.EmailField()
product_info = models.CharField(max_length=200)
Expand All @@ -34,12 +35,15 @@ class TransactionStatus:

payment_id = models.CharField(max_length=50, null=True)

class Meta:
unique_together = (('phone', 'product_info'),)

@property
def Status(self):
return TransactionModel.TransactionStatus.STATUS_DESCRIPTION[self.status]

def __str__(self):
return str(self.id) + " : " + self.phone + " : " + self.product_info + " |amount: " + str(self.amount) \
return str(self.transaction_id) + " : " + self.phone + " : " + self.product_info + " |amount: " + str(self.amount) \
+ " |status: " +self.Status + " |payment ID: " \
+ str(self.payment_id if self.payment_id is not None else "NaN")

Expand Down
8 changes: 7 additions & 1 deletion ritu18/apps/registration/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def dispatch(self, request, *args, **kwargs):
return super(PaymentRequestAccept, self).dispatch(request, *args, **kwargs)

def post(self, request):
phone = request.POST['phone']
product_info = request.POST['product_info']
if RegistrationModel.objects.filter(profile__phone=phone, event_code=product_info).exists():
return JsonResponse({'status':'Repeated Registration'}) #TODO change
try:
if request.POST['product_info'] not in event_details:
return JsonResponse({'status': 'Invalid Event Code'}) #TODO change
Expand All @@ -31,11 +35,13 @@ def post(self, request):
product_info=request.POST['product_info'],
name=request.POST['name'])
transaction.save()
transaction.transaction_id = 'TEST00' + str(transaction.id)
transaction.save()

hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10"
data = {
'key': MERCHANT_KEY,
'txnid': transaction.id,
'txnid': transaction.transaction_id,
'amount': transaction.amount,
'productinfo': transaction.product_info,
'firstname': transaction.name,
Expand Down

0 comments on commit ff1c702

Please sign in to comment.