def callback(request): if request.method == 'GET': data = request.GET.dict() if data['success']: return success(request) else: return error(request) elif request.method == 'POST': data = request.POST.dict() if data['success']: print "VALID" sys.stdout.flush() change_order_status(data['merchantReference'], "VALIDATED") return HttpResponse("[accepted]", mimetype="text/plain") else: print "ERROR" sys.stdout.flush() change_order_status(data['merchantReference'], "ERROR") return HttpResponse("[error]", mimetype="text/plain")
def success(request): params = request.GET.get order = params('orderKey') order_id = order.split("^") change_order_status(order_id[2], "VALIDATED") return render(request, 'success.html', {})
def error(request): params = request.GET.get order = params('orderKey') order_id = order.split("^") change_order_status(order_id[2], "ERROR") return render(request, 'error.html', {})