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):
|
||||
return {'X-Token': self.token, 'Content-type': 'application/json', 'Accept': 'application/json'}
|
||||
|
||||
def check_whether_booking_available(self, restaurant_id, date: str):
|
||||
super().check_whether_booking_available(restaurant_id, date)
|
||||
url = f'{self.url}v1/runtime_services'
|
||||
params = {'restaurant_id': restaurant_id, 'date': date, 'expands[]': 'table_availabilities'}
|
||||
def check_whether_booking_available(self, restaurant_id, *args, **kwargs):
|
||||
url = f'{self.url}v1/periods'
|
||||
params = {'restaurant_id': restaurant_id, **kwargs}
|
||||
r = requests.get(url, headers=self.get_common_headers(), params=params)
|
||||
if not status.is_success(r.status_code):
|
||||
return False
|
||||
response = json.loads(r.content)['runtime_services']
|
||||
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
|
||||
self.response = r.json()
|
||||
return True
|
||||
|
||||
def commit_booking(self, payload, stripe_token = None):
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ class CheckWhetherBookingAvailable(generics.GenericAPIView):
|
|||
service = l_service
|
||||
service.service_id = establishment.lastable_id
|
||||
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
|
||||
service = g_service
|
||||
service.service_id = establishment.guestonline_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user