Beispiel #1
0
def handlerequest(request, transaction_id):
    # paytm will send you post request here
    try:
        sub_obj = Subscription.objects.get(transaction_id=transaction_id)
    except Subscription.DoesNotExist:
        print("Invalid Subscription ID")
        return redirect('/adv')

    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]

    screen = sub_obj.screen
    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        if response_dict['RESPCODE'] == '01' and screen.ad_available > 0:
            ad = sub_obj.ad
            disAd = DisplaysAd(screen=screen, ad=ad)
            disAd.save()
            sub_obj.transaction_status = "Transaction Successful"
            sub_obj.save()
            screen.ad_available = screen.ad_available - 1
            screen.save()
            print('order successful')
        else:
            print('order was not successful because' +
                  response_dict['RESPMSG'])
    return render(request, 'Advertiser/paymentstatus.html',
                  {'response': response_dict})
def handlerequest(request):
    # paytm will send you post request here
    form = request.POST
    response_dict = {}
    pk = None
    f = None
    t = None
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]
    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        print(response_dict['RESPCODE'])
        if response_dict['RESPCODE'] == '01':
            print('order successful')
            i = response_dict['ORDERID']
            print(i)
            t = i[6:]
            Fee.objects.filter(orderid=t).update(paymentstatus='success')

        else:
            print('order was not successful because' +
                  response_dict['RESPMSG'])
        i = response_dict['ORDERID']
        t = i[6:]
        f = Fee.objects.get(orderid=t)
        print(f.pk)
    return render(request, 'fee/paymentstatus.html', {
        'response_dict': response_dict,
        'f': f
    })
def handlerequest(request):
    # paytm will send you post request here
    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]

    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        if response_dict['RESPCODE'] == '01':
            print('order successful')
            order = Orders.objects.get(id=response_dict['ORDERID'])

            th1 = threading.Thread(
                target=sendemail, args=[response_dict['ORDERID'], order.email])
            th1.start()
        else:
            print('order was not successful because' +
                  response_dict['RESPMSG'])
            order = Orders.objects.filter(id=response_dict['ORDERID'])
            order.delete()
            update = OrderUpdate.objects.filter(id=response_dict['ORDERID'])
            update.delete()
    return render(request, 'store/paymentstatus.html',
                  {'response': response_dict})
Beispiel #4
0
def handlerequest(request):
	form=request.POST
	response_dict = {}
	for i in form.keys():
		response_dict[i]=form[i]
		if i=='CHECKSUMHASH':
			checksum = form[i]
	verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
	if verify:
		if response_dict['RESPCODE']=='01':
			print('successfull')
		else:
			print('Unsuccessfull')
		return render(request,'myapp/paymentstatus.html', {'response': response_dict})
Beispiel #5
0
def handlerequest(request):
    # paytm will send you post request here
    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]
    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        if response_dict['RESPCODE'] == '01':
            print('order success full')
        else:
            #order_success=messages.error(request,f'order was not successful because {response_dict[RESPMSG]}')
            print('order was not successful because' + response_dict['RESPMSG'])
    return render(request, 'mySchool/paymentstatus.html', {'response': response_dict})
Beispiel #6
0
def handlerequest(request, course_slug, username):
    user = Account.objects.get(username=username)
    for _ in range(10):
        print("hello")
        print(user.email)
    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]
    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        if response_dict['RESPCODE'] == '01':
            course = Course.objects.get(slug=course_slug)
            # user=request.user
            name = 'name'
            email = user.email
            mobile = user.phone_number
            amount = float(course.price)
            order = Transaction.objects.create(user=user,
                                               item_json=course.name,
                                               course=course,
                                               name=name,
                                               email=email,
                                               mobile=mobile,
                                               amount=float(amount))
            order.save()
            course.member.add(user)
            course.save()
            messages.success(request, "Course is successfully purchase")
            return redirect("purchase_course")
            # print('order successful')
            # print('order successful')
            # print('order successful')
            # print('order successful')
            # print('order successful')
            # print('order successful')
            # print('order successful')

        else:
            messages.error(request, "Something Went Wrong")
            return redirect("checkout", course_slug)
            # print('Something went wrong' + response_dict['RESPMSG'])
    return render(request, 'paytm/paytm_payment_status.html',
                  {'response_dict': response_dict})
Beispiel #7
0
def handlerequest(request):
    # paytm will send you post request here
    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]

    verfiy = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verfiy:
        if response_dict['RESPCODE'] == '01':
            print('ORDER SUCCESSFUL')
        else:
            print("order unsuccessful because" + response_dict['RESPMSG'])
    return render(request, 'E_com/paymentstatus.html',
                  {'response': response_dict})
Beispiel #8
0
def handlerequest(request):
    # paytm will send you post request here
    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]

    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        print('Order successful')
    else:
        messages.error(
            request,
            'Order was not successful because' + response_dict['RESPMSG'])
        return redirect('Checkout')
    return render(request, 'shop/paymentstatus.html',
                  {'response': response_dict})
Beispiel #9
0
    def post(self, request):
        form = request.POST
        response_dict = {}
        for i in form.keys():
            response_dict[i] = form[i]
            if i == 'CHECKSUMHASH':
                checksum = form[i]

        verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY,
                                          checksum)
        if verify:
            if response_dict['RESPCODE'] == '01':

                print('order successful')
            else:
                print('order was not successful because' +
                      response_dict['RESPMSG'])

        return render(request, 'app/paymentstatus.html',
                      {'response': response_dict})
Beispiel #10
0
def handlerequest(request):
    #paytm post req
    form = request.POST
    response_dict = {}
    for i in form.keys():
        response_dict[i] = form[i]
        if i == 'CHECKSUMHASH':
            checksum = form[i]
    verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum)
    if verify:
        if response_dict['RESPCODE'] == '01':
            print('Payment successfull')
            msg = Rent.objects.get(order_id=response_dict['ORDERID'])
            msg.paid = True
            msg.paid_on = response_dict['TXNDATE']
            msg.save()
        else:
            print('Payment was not successfull because' +
                  response_dict['RESPMSG'])

    return render(request, 'paymentstatus.html', {'resp': response_dict})