Ejemplo n.º 1
0
def getAllParkingRates(parkingIdentificationCode):
    request = __getAllParkingRatesRequest(parkingIdentificationCode)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_FIND + PARKING_RATES_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    return json2object(edict(data))
Ejemplo n.º 2
0
def getAllVehicleType(parkingIdentificationCode):
    request = __getAllVehicleTypeRequest(parkingIdentificationCode)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_FIND + VEHICLE_TYPE_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    return json2object(edict(data))
Ejemplo n.º 3
0
def login(user, password):
    request = getRequest(user, password)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = json2object(edict(data))
    if type(obj) != Error:
        return obj
    else:
        raise LoginException(obj.message)
Ejemplo n.º 4
0
def findParkingRatesById(parkingIdentificationCode, id):
    r = None
    
    request = __getFindParkingRatesByIdRequest(parkingIdentificationCode, id)
    logging.info(object2json(request))
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_FIND_BY_ID + PARKING_RATES_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    return json2object(obj)
Ejemplo n.º 5
0
def findFrequencyTypeById(parkingIdentificationCode, id):
    r = None
    
    request = __getFindFrequencyTypeByIdRequest(parkingIdentificationCode, id)
    logging.info(object2json(request))
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_FIND_BY_ID + FREQUENCY_TYPE_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    return json2object(obj)
Ejemplo n.º 6
0
def updateVehicleType(parkingIdentificationCode, id, description):
    r = None
    
    request = __getUpdateVehicleTypeRequest(parkingIdentificationCode, id, description)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_UPDATE + VEHICLE_TYPE_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    
    if (obj.status == "success"):
        r = obj.status
    else:
        r = json2object(obj)

    return r
Ejemplo n.º 7
0
def updateParkingRates(parkingIdentificationCode, id, vehicleTypeId, frequencyTypeId, amount):
    r = None
    
    request = __getUpdateParkingRatesRequest(parkingIdentificationCode, id, vehicleTypeId, frequencyTypeId, amount)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_UPDATE + PARKING_RATES_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    
    if (obj.status == "success"):
        r = obj.status
    else:
        r = json2object(obj)

    return r
Ejemplo n.º 8
0
def saveParkingRate(parkingIdentificationCode, idVehicleSelected, idFrequencySelected, amount):
    result = None
    
    request = __getSaveParkingRateRequest(parkingIdentificationCode, idVehicleSelected, idFrequencySelected, amount)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_SAVE + PARKING_RATES_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    
    if (obj.status == "success"):
        result = obj.status
    else:
        result = json2object(obj)

    return result
Ejemplo n.º 9
0
def updateFrequencyType(parkingIdentificationCode, id, description, timeType, time, type, priority, combinablePreviousFrequency):
    r = None
    
    request = __getUpdateFrequencyTypeRequest(parkingIdentificationCode, id, description, timeType, time, type, priority, combinablePreviousFrequency)
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_UPDATE + FREQUENCY_TYPE_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    
    if (obj.status == "success"):
        r = obj.status
    else:
        r = json2object(obj)

    return r
Ejemplo n.º 10
0
def removeParkingRate(parkingIdentificationCode, id):
    r = None
    
    request = __getRemoveParkingRateRequest(parkingIdentificationCode, id)
    logging.info(object2json(request))
    dataEncrypted = encrypt.encrypted(object2json(request))
    response = sendRequest(URL_REMOVE + PARKING_RATES_REQUEST, dataEncrypted)
    logging.info(response)
    data = json.loads(response)
    obj = edict(data)
    
    if (obj.status == "success"):
        r = obj.status
    else:
        r = json2object(obj)

    return r
Ejemplo n.º 11
0
def createRequestToApplicationRest():
    payload = Payload('')
    request = Request(payload, buildMac(object2json('')), 'HASH-PUBLIC-WEB')
    return encrypt.encrypted(object2json(request))