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))
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))
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)
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)
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)
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
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
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
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
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
def createRequestToApplicationRest(): payload = Payload('') request = Request(payload, buildMac(object2json('')), 'HASH-PUBLIC-WEB') return encrypt.encrypted(object2json(request))