def credit(request): data = request.POST student = Student.objects.get(penncard=data.get("penncard")) plan_element_id = data.get("plan") plan = plan_element_id.replace("_", " ").title() plan = Plan.objects.get(name=plan) payment = Payment( amount=plan.cost, plan=plan, student=student, satisfied=False, payment_type="credit", ) payment.save() payment_email(student) return HttpResponse(payment.id)
def credit(request): data = request.POST datamap = process_data(data) student = datamap['student'] plan = datamap['plan'] payment = Payment( amount=plan.cost, plan=plan, student=student, satisfied=False, payment_type="credit", renew=datamap['renew'], end_date=datamap['end_date'] ) payment.save() payment_email(student) return HttpResponse(payment.id)
def cash(request): data = request.POST student = Student.objects.get(penncard=data.get("penncard")) plan_element_id = data.get("plan") plan = plan_element_id.replace("_", " ").title() plan = Plan.objects.get(name=plan) payment = Payment( amount=plan.cost, plan=plan, student=student, purchase_date=timezone.datetime.today(), satisfied=False, payment_type="cash", ) payment.save() messages.info(request, "Your payment has been processed. Please come to Penn" "Student Agencies and pay at the front desk.") payment_email(student) return HttpResponse("success")
def cash(request): data = request.POST datamap = process_data(data) student = datamap['student'] plan = datamap['plan'] payment = Payment( amount=plan.cost, plan=plan, student=student, payment_date=timezone.datetime.today(), satisfied=True, payment_type="cash", renew=datamap['renew'], end_date=datamap['end_date'] ) payment.save() messages.info(request, "Your payment has been processed. Please come to Penn" "Student Agencies and pay at the front desk.") payment_email(student) return HttpResponse("success")
def bursar(request): data = request.POST student = Student.objects.get(penncard=data.get("penncard")) plan_element_id = data.get("plan") plan = plan_element_id.replace("_", " ").title() plan = Plan.objects.get(name=plan) renew = data.get("renew") if renew == "true": renew = True else: renew = False payment = Payment( amount=plan.cost, plan=plan, student=student, satisfied=True, payment_type="bursar", renew=renew, payment_date=timezone.datetime.now() ) payment.save() message = ''' Name: {}\n Penncard and last two digits: {} and {}\n Plan: {}\n Renew: {}\n Living location: {}\n Bursar them, and if there is a problem, notify Razzi. Thanks! '''.format(student.name, student.penncard, student.last_two, plan, renew, student.living_location) send_mail( 'Student Registered with Bursar', message, '*****@*****.**', ['*****@*****.**'] ) messages.info(request, "You have successfully paid by Bursar!") payment_email(student) return HttpResponse("success")
def bursar(request): data = request.POST datamap = process_data(data) student = datamap['student'] plan = datamap['plan'] payment = Payment( amount=plan.cost, plan=plan, student=student, satisfied=True, payment_type="bursar", renew=datamap['renew'], end_date=datamap['end_date'], payment_date=timezone.datetime.now() ) payment.save() message = ''' Name: {}\n Penncard and last two digits: {} and {}\n Plan: {}\n Renew: {}\n Living location: {}\n Bursar them, and if there is a problem, notify Razzi. Thanks! '''.format(student.name, student.penncard, student.last_two, plan, datamap['renew'], student.living_location) send_mail( 'Student Registered with Bursar', message, '*****@*****.**', ['*****@*****.**'] ) messages.info(request, "You have successfully paid by Bursar!") payment_email(student) return HttpResponse("success")