Пример #1
0
def createInvoice_route():
    print("request @createInvoice arrived...")
    content = request.get_json()
    response = {}
    if (vc.validateRequest(content) and ua.userIsAuthorized(content, 'createInvoice')):
        response = Main.createInvoice(content)
    if ('error' in content):
        response['error'] = content['error']
        return json.dumps(response, default=str)
    return json.dumps(response, default=str)
Пример #2
0
def getQuote_route():
    print("request @getQuote arrived...")
    content = request.get_json()
    response = {}
    if (vc.validateRequest(content) and ua.userIsAuthorized(content, 'getQuote')):
        response = Main.getQuote(content)
    if ('error' in content):
        response['error'] = content['error']
        return json.dumps(response)
    return json.dumps(response)
Пример #3
0
def processOrder_route():
    print("request @processOrder arrived...")
    content = request.get_json()
    response = {}
    if (vc.validateRequest(content) and ua.userIsAuthorized(content, 'processOrder')):
        response = Main.processOrder(content)
    if ('error' in content):
        response['error'] = content['error']
        return json.dumps(response, default=str)
    return json.dumps(response, default=str)
Пример #4
0
def registerUser_route():
    print("request @registerUser arrived...")
    content = request.get_json()
    response = {}
    if(vc.validateRequest(content)):
        response = Main.registerUser(content)
    if('error' in content):
        response['error'] = content['error']
        return json.dumps(response)
    return json.dumps(response)
Пример #5
0
def login_route():
    print("request @login arrived...")
    content = request.get_json() #replace user with content
    response = {}
    if(vc.validateRequest(content)):
        response = Main.login(content)
    if('error' in content):
        response['error'] = content['error']
        return json.dumps(response)
    return json.dumps(response)
Пример #6
0
def getAllTransactionHistory_route():
    print("request @getAllTransactionHistory arrived...")
    content = request.get_json()
    response = {}
    if (vc.validateRequest(content) and ua.userIsAuthorized(content, 'getAllTransactionHistory')):
        response = Main.getAllTransactionHistory(content)
    if ('error' in content):
        response['error'] = content['error']
        return json.dumps(response, default=str)
    return json.dumps(response, default=str)
Пример #7
0
    # all SQL commands (split on ';')
    sqlCommands = sqlFile.split(';')

    for command in sqlCommands:
        try:
            db.run(command)
            print('command executed')
        except:
            print('command failed')


executeScriptsFromFile('test/no.sql')

print('************************************************')
"""~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""

input = {}
output = Main.login(input)
print(output)

print('#######')

input = {'username': '******', 'password': '******'}
output = Main.login(input)
print(output)

print('#######')

input = {'username': '******', 'password': '******'}
output = Main.login(input)
print(output)