notif_report #3
@@ -741,9 +741,30 @@ def create_xml_from_db(list: list[Tuple[Reservation, Customer]]):
|
|||||||
room_stays = OtaResRetrieveRs.ReservationsList.HotelReservation.RoomStays(
|
room_stays = OtaResRetrieveRs.ReservationsList.HotelReservation.RoomStays(
|
||||||
room_stay=[room_stay],
|
room_stay=[room_stay],
|
||||||
)
|
)
|
||||||
klick_id = reservation.fbclid or reservation.gclid
|
|
||||||
|
|
||||||
|
res_id_source = "website"
|
||||||
|
|
||||||
|
if reservation.fbclid != "":
|
||||||
|
klick_id = reservation.fbclid
|
||||||
|
res_id_source = "meta"
|
||||||
|
elif reservation.gclid != "":
|
||||||
|
klick_id = reservation.gclid
|
||||||
|
res_id_source = "google"
|
||||||
|
|
||||||
|
|
||||||
|
# explicitly set klick_id to None otherwise an empty string will be sent
|
||||||
|
if klick_id in (None, "", "None"):
|
||||||
|
klick_id = None
|
||||||
|
else: # extract string from Column object
|
||||||
|
klick_id = str(klick_id)
|
||||||
|
|
||||||
|
hotel_res_id_data = HotelReservationIdData(
|
||||||
|
res_id_type="13",
|
||||||
|
res_id_value=klick_id,
|
||||||
|
res_id_source=res_id_source,
|
||||||
|
res_id_source_context="99tales",
|
||||||
|
)
|
||||||
|
|
||||||
# explicitly set klick_id to None otherwise an empty string will be sent
|
# explicitly set klick_id to None otherwise an empty string will be sent
|
||||||
if klick_id in (None, "", "None"):
|
if klick_id in (None, "", "None"):
|
||||||
klick_id = None
|
klick_id = None
|
||||||
|
|||||||
@@ -53,10 +53,14 @@ class AlpineBitsActionName(Enum):
|
|||||||
OTA_PING = ("action_OTA_Ping", "OTA_Ping:Handshaking")
|
OTA_PING = ("action_OTA_Ping", "OTA_Ping:Handshaking")
|
||||||
OTA_READ = ("action_OTA_Read", "OTA_Read:GuestRequests")
|
OTA_READ = ("action_OTA_Read", "OTA_Read:GuestRequests")
|
||||||
OTA_HOTEL_AVAIL_NOTIF = ("action_OTA_HotelAvailNotif", "OTA_HotelAvailNotif")
|
OTA_HOTEL_AVAIL_NOTIF = ("action_OTA_HotelAvailNotif", "OTA_HotelAvailNotif")
|
||||||
OTA_HOTEL_RES_NOTIF_GUEST_REQUESTS = (
|
OTA_HOTEL_RES_NOTIF_GUEST_REQUESTS = ( ## Push Action for Guest Requests
|
||||||
"action_OTA_HotelResNotif_GuestRequests",
|
"action_OTA_HotelResNotif_GuestRequests",
|
||||||
"OTA_HotelResNotif:GuestRequests",
|
"OTA_HotelResNotif:GuestRequests",
|
||||||
)
|
)
|
||||||
|
OTA_HOTEL_NOTIF_REPORT = (
|
||||||
|
"action_OTA_Read", # if read is supported this is also supported
|
||||||
|
"OTA_NotifReport:GuestRequests",
|
||||||
|
)
|
||||||
OTA_HOTEL_DESCRIPTIVE_CONTENT_NOTIF_INVENTORY = (
|
OTA_HOTEL_DESCRIPTIVE_CONTENT_NOTIF_INVENTORY = (
|
||||||
"action_OTA_HotelDescriptiveContentNotif_Inventory",
|
"action_OTA_HotelDescriptiveContentNotif_Inventory",
|
||||||
"OTA_HotelDescriptiveContentNotif:Inventory",
|
"OTA_HotelDescriptiveContentNotif:Inventory",
|
||||||
@@ -548,7 +552,7 @@ class NotifReportReadAction(AlpineBitsAction):
|
|||||||
"""Necessary for read action to follow specification. Clients need to report acknowledgements"""
|
"""Necessary for read action to follow specification. Clients need to report acknowledgements"""
|
||||||
|
|
||||||
def __init__(self, config: Dict = {}):
|
def __init__(self, config: Dict = {}):
|
||||||
self.name = AlpineBitsActionName.OTA_HOTEL_RES_NOTIF_GUEST_REQUESTS
|
self.name = AlpineBitsActionName.OTA_HOTEL_NOTIF_REPORT
|
||||||
self.version = [Version.V2024_10, Version.V2022_10]
|
self.version = [Version.V2024_10, Version.V2022_10]
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
@@ -661,6 +665,7 @@ class AlpineBitsServer:
|
|||||||
def _initialize_action_instances(self):
|
def _initialize_action_instances(self):
|
||||||
"""Initialize instances of all discovered action classes."""
|
"""Initialize instances of all discovered action classes."""
|
||||||
for capability_name, action_class in self.capabilities.action_registry.items():
|
for capability_name, action_class in self.capabilities.action_registry.items():
|
||||||
|
_LOGGER.info(f"Initializing action instance for {capability_name}")
|
||||||
self._action_instances[capability_name] = action_class(config=self.config)
|
self._action_instances[capability_name] = action_class(config=self.config)
|
||||||
|
|
||||||
def get_capabilities(self) -> Dict:
|
def get_capabilities(self) -> Dict:
|
||||||
@@ -700,6 +705,8 @@ class AlpineBitsServer:
|
|||||||
|
|
||||||
# Find the action by request name
|
# Find the action by request name
|
||||||
action_enum = AlpineBitsActionName.get_by_request_name(request_action_name)
|
action_enum = AlpineBitsActionName.get_by_request_name(request_action_name)
|
||||||
|
|
||||||
|
_LOGGER.info(f"Handling request for action: {request_action_name} with action enum: {action_enum}")
|
||||||
if not action_enum:
|
if not action_enum:
|
||||||
return AlpineBitsResponse(
|
return AlpineBitsResponse(
|
||||||
f"Error: Unknown action {request_action_name}",
|
f"Error: Unknown action {request_action_name}",
|
||||||
|
|||||||
Reference in New Issue
Block a user