194 |
194 |
data = self._call_planitech(self.requests.get, 'getPlacesList')
|
195 |
195 |
ref = {}
|
196 |
196 |
for place in data['placesList']:
|
197 |
|
ref[place['identifier']] = {
|
198 |
|
'identifier': place['identifier'], 'label': place['label']
|
|
197 |
place_id = int(place['identifier'])
|
|
198 |
ref[place_id] = {
|
|
199 |
'identifier': place_id, 'label': place['label']
|
199 |
200 |
}
|
200 |
201 |
|
201 |
202 |
data = self._call_planitech(
|
202 |
203 |
self.requests.post, 'getPlacesInfo',
|
203 |
204 |
{
|
204 |
|
"placeIdentifiers": list(ref.keys()),
|
|
205 |
"placeIdentifiers": [float(key) for key in ref.keys()],
|
205 |
206 |
"extensionAttributes": {
|
206 |
207 |
"capacity": {
|
207 |
208 |
"name": "TOTCAP",
|
... | ... | |
211 |
212 |
}
|
212 |
213 |
)
|
213 |
214 |
for place in data['requestedPlaces']:
|
214 |
|
ref[place['identifier']]['capacity'] = place.get('capacity')
|
215 |
|
ref[place['identifier']]['street_number'] = place.get('streetNumber')
|
216 |
|
ref[place['identifier']]['address'] = place.get('address1')
|
217 |
|
ref[place['identifier']]['city'] = place.get('city')
|
218 |
|
ref[place['identifier']]['zipcode'] = place.get('zipCode')
|
|
215 |
place_id = int(place['identifier'])
|
|
216 |
capacity = place.get('capacity')
|
|
217 |
if capacity is not None:
|
|
218 |
capacity = int(capacity)
|
|
219 |
ref[place_id]['capacity'] = capacity
|
|
220 |
ref[place_id]['street_number'] = place.get('streetNumber')
|
|
221 |
ref[place_id]['address'] = place.get('address1')
|
|
222 |
ref[place_id]['city'] = place.get('city')
|
|
223 |
ref[place_id]['zipcode'] = place.get('zipCode')
|
219 |
224 |
|
220 |
225 |
cache.set(cache_key, ref)
|
221 |
226 |
return ref
|
... | ... | |
280 |
285 |
raise APIError("Reservation creation failed: no reservation ID")
|
281 |
286 |
return {
|
282 |
287 |
'data': {
|
283 |
|
'reservation_id': reservation_id,
|
|
288 |
'reservation_id': int(reservation_id),
|
284 |
289 |
'raw_data': data
|
285 |
290 |
}
|
286 |
291 |
}
|
... | ... | |
307 |
312 |
def _place_display(self, raw_data):
|
308 |
313 |
available_places = []
|
309 |
314 |
for place in raw_data.get('availablePlaces', []):
|
310 |
|
available_places.append(place['placeIdentifier'])
|
|
315 |
available_places.append(int(place['placeIdentifier']))
|
311 |
316 |
places_ref = self._get_places_referential()
|
312 |
317 |
res = []
|
313 |
318 |
for place in available_places:
|
... | ... | |
323 |
328 |
all_dates = [d['id'] for d in res['date']]
|
324 |
329 |
full = []
|
325 |
330 |
for place in raw_data.get('availablePlaces', []):
|
326 |
|
place_id = place['placeIdentifier']
|
|
331 |
place_id = int(place['placeIdentifier'])
|
327 |
332 |
place_data = {
|
328 |
|
'id': int(place_id),
|
|
333 |
'id': place_id,
|
329 |
334 |
'text': places_ref[place_id]['label'],
|
330 |
335 |
'dates': []
|
331 |
336 |
}
|
... | ... | |
424 |
429 |
|
425 |
430 |
# Places restriction
|
426 |
431 |
if place_id is not None:
|
427 |
|
places_id = [float(place_id)]
|
|
432 |
places_id = [int(place_id)]
|
428 |
433 |
else:
|
429 |
434 |
places_id = self._get_places_by_capacity(int(min_capacity), int(max_capacity))
|
430 |
435 |
|
431 |
436 |
params = {
|
432 |
|
"placeIdentifiers": places_id,
|
|
437 |
"placeIdentifiers": [float(p_id) for p_id in places_id],
|
433 |
438 |
"startingDate": utc_start_datetime,
|
434 |
439 |
"endingDate": utc_end_datetime,
|
435 |
440 |
"requestedStartingTime": float(0),
|