Use another GO endpoint
This commit is contained in:
parent
4cb44aa1fc
commit
261d70af53
|
|
@ -73,17 +73,13 @@ class GuestonlineService(AbstractBookingService):
|
||||||
def get_common_headers(self):
|
def get_common_headers(self):
|
||||||
return {'X-Token': self.token, 'Content-type': 'application/json', 'Accept': 'application/json'}
|
return {'X-Token': self.token, 'Content-type': 'application/json', 'Accept': 'application/json'}
|
||||||
|
|
||||||
def check_whether_booking_available(self, restaurant_id, date: str):
|
def check_whether_booking_available(self, restaurant_id, *args, **kwargs):
|
||||||
super().check_whether_booking_available(restaurant_id, date)
|
url = f'{self.url}v1/periods'
|
||||||
url = f'{self.url}v1/runtime_services'
|
params = {'restaurant_id': restaurant_id, **kwargs}
|
||||||
params = {'restaurant_id': restaurant_id, 'date': date, 'expands[]': 'table_availabilities'}
|
|
||||||
r = requests.get(url, headers=self.get_common_headers(), params=params)
|
r = requests.get(url, headers=self.get_common_headers(), params=params)
|
||||||
if not status.is_success(r.status_code):
|
if not status.is_success(r.status_code):
|
||||||
return False
|
return False
|
||||||
response = json.loads(r.content)['runtime_services']
|
self.response = r.json()
|
||||||
keys_to_preserve = {'left_seats', 'table_availabilities', 'closed', 'start_time', 'end_time', 'last_booking'}
|
|
||||||
response = map(lambda x: self.get_certain_keys(x, keys_to_preserve), response)
|
|
||||||
self.response = response
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def commit_booking(self, payload, stripe_token = None):
|
def commit_booking(self, payload, stripe_token = None):
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ class CheckWhetherBookingAvailable(generics.GenericAPIView):
|
||||||
service = l_service
|
service = l_service
|
||||||
service.service_id = establishment.lastable_id
|
service.service_id = establishment.lastable_id
|
||||||
elif (not establishment.guestonline_id is None) and g_service \
|
elif (not establishment.guestonline_id is None) and g_service \
|
||||||
.check_whether_booking_available(establishment.guestonline_id, date):
|
.check_whether_booking_available(establishment.guestonline_id,
|
||||||
|
**g_service.get_certain_keys(request.query_params,
|
||||||
|
{'date', 'persons'})):
|
||||||
is_booking_available = True
|
is_booking_available = True
|
||||||
service = g_service
|
service = g_service
|
||||||
service.service_id = establishment.guestonline_id
|
service.service_id = establishment.guestonline_id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user