예제 #1
0
def paymentcancelGet(request):
    if 'pid' in request.GET and 'ref' in request.GET and 'checksum' in request.GET:
        if validate_payment(request.GET['pid'], request.GET['ref'], request.GET['checksum']):
            return HttpResponseRedirect(reverse('orderitem', kwargs={'order_id' : request.GET['pid']}) + '?status=cancel')
        else:
            return HttpResponseRedirect(reverse('orderitem', kwargs={'order_id' : request.GET['pid']}) + '?status=fail')
    else:
        return HttpResponseBadRequest()
예제 #2
0
def paymentsuccessGet(request):
    if 'pid' in request.GET and 'ref' in request.GET and 'checksum' in request.GET:
        if validate_payment(request.GET['pid'], request.GET['ref'], request.GET['checksum']):
            order = get_object_or_404(Order, pk=request.GET['pid'])
            order.payment_ref = request.GET['ref']
            order.save()

            return HttpResponseRedirect(reverse('orderitem', kwargs={'order_id' : request.GET['pid']}) + '?status=success')
        else:
            return HttpResponseRedirect(reverse('orderitem', kwargs={'order_id' : request.GET['pid']}) + '?status=fail')
    else:
        return HttpResponseBadRequest()