Exemplo n.º 1
0
def update():
    student = Student.get_by_id(get_jwt_identity())
    params = request.json

    if student:
        payment = Payment.get_by_id(params.get("payment_id"))
        payment.status = 'complete'
        payment.status_timestamp = datetime.now()

    if payment.save():
        responseObject = (
            {
                "message" : "Payment received." ,
                "status" : "success!",
                "payment" : {
                    "id" : payment.id,
                    "amount" : payment.amount,
                    "status" : payment.status,
                    "status_timestamp" : payment.status_timestamp,
                    "student_tutor_session" : payment.student_tutor_session_id
                }
            }
        )
        return make_response(jsonify(responseObject)), 200
    else:
        return make_response(jsonify([err for err in payment.errors])), 400
Exemplo n.º 2
0
def edit_payment(payment_id):
    payment = Payment.get_by_id(payment_id)
    return make_response(back_to_profile())