예제 #1
0
def autopay(request):
	card_number = request.POST['card_number']
	account_no = request.POST['account_no']
	amount = request.POST['amount']
	description = request.POST['description']
	date = request.POST['date']
	#installment = request.POST['installment']
	USER = request.session['USER']
	try:
		Card.objects.get(card_number=card_number)
	except (KeyError, Card.DoesNotExist):
		return HttpResponse("ERROR: Incorrect Card Number ")
	else:
		if(amount == '' or date == ''):
			return HttpResponse('Error: All Fields are necessary.')
		elif(float(amount) < 100 or float(amount)>5000):
			return HttpResponse('Error: Fields are not set properly.')
		else:
			a = Autopay(to_account=account_no, description=description, date=date, amount=amount, user=USER)				
			a.save()
		return HttpResponseRedirect('services.html')
예제 #2
0
def removeAutopay(request, remove_id):
	a = Autopay(id=remove_id)
	a.delete()
	return HttpResponseRedirect('/creditcard/user/services.html')