Skip to content

Commit 9e8fee6

Browse files
authored
Tnr 1904 checkout blocklist (#27)
* Added create_blocklist_endpoint.
1 parent 19f753e commit 9e8fee6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

vacasa/connect/connect.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,44 @@ def create_reservation(self,
649649

650650
return self._post(url, json={'data': {'attributes': payload}}, headers=headers).json()
651651

652+
def create_blocklist_entry(self,
653+
reservation_id: int,
654+
first_name: str,
655+
last_name: str,
656+
email: str,
657+
phone: str,
658+
reason: str,
659+
block: bool,
660+
warn: bool) -> dict:
661+
"""
662+
Add users to Vacasa's blocklist.
663+
664+
:param reservation_id: A reservation id created when creating a canceled reservation.
665+
:param first_name:
666+
:param last_name:
667+
:param email:
668+
:param phone:
669+
:param reason: Reason for adding user to Vacasa's blocklist.
670+
:param block: 1 for iDology hard fail, else 0
671+
:param warn: 1 for iDology soft fail, else 0
672+
673+
:return: # TODO: paste in example response after CONN-318 completion
674+
"""
675+
676+
url = f"{self.endpoint}/v1/blocklists"
677+
headers = self._headers()
678+
payload = {
679+
'reservation_id': reservation_id,
680+
'first_name': first_name,
681+
'last_name': last_name,
682+
'email': email,
683+
'phone': phone,
684+
'reason': reason,
685+
'block': block,
686+
'warn': warn,
687+
}
688+
689+
return self._post(url, json={'data': {'attributes': payload, 'type':'blocklists'}}, headers=headers).json()
652690

653691
def _handle_http_exceptions(response):
654692
"""Log 400/500s and raise them as exceptions"""

0 commit comments

Comments
 (0)