Ejemplo n.º 1
0
def worker():
    while run:
        venmos = check_venmos()
        for venmo in venmos:
            if venmo['Amount'] >= s.price:
                dispense_beer()
                # TODO: Drive LCD
            add_transaction(venmo)
        sleep(refresh_rate)
Ejemplo n.º 2
0
def demo():
    if request.method == "POST":
        data = request.json
        data = t.add_transaction(data)
        rval = {
            "message": "Successly created transaction",
            "statusCode": 200,
            "data": data
        }
        return JSONEncoder().encode(rval), 200
Ejemplo n.º 3
0
def transaction():
    if verify_user(request.headers['jwt']):
        if request.method == 'POST':
            return add_transaction(request, Session)
        elif request.method == 'PUT':
            return "2"
        elif request.method == 'DELETE':
            return "3"
        elif request.method == 'GET':
            book_id = request.args.get('book_id')
            user_id = get_user_id(request.headers['jwt'])

            verify_book_access(book_id, user_id)
            return json.dumps([
                i.serialize
                for i in Transaction.query.filter_by(book_id=book_id)
            ])
        return "0"
    return '-1'
Ejemplo n.º 4
0
def withdraw(description, out_amount):
    add_transaction(description, '', out_amount)
    click.echo('New balance: {}'.format(get_balance()))
Ejemplo n.º 5
0
def deposit(description, in_amount):
    add_transaction(description, in_amount, '')
    click.echo('New balance: {}'.format(get_balance()))