Works but form_id is not unique. Need to find something else

This commit is contained in:
Jonas Linter
2025-09-29 16:09:42 +02:00
parent 54c002ac96
commit 7f25fb2b02
3 changed files with 337 additions and 1 deletions

View File

@@ -17,6 +17,10 @@ from xml.etree import ElementTree as ET
from dataclasses import dataclass
from enum import Enum, IntEnum
from alpine_bits_python.alpine_bits_helpers import PhoneTechType, create_xml_from_db
from .generated.alpinebits import OtaPingRq, OtaPingRs, WarningStatus, OtaReadRq
from xsdata_pydantic.bindings import XmlSerializer
from xsdata.formats.dataclass.serializers.config import SerializerConfig
@@ -407,6 +411,8 @@ def validate_hotel_authentication(username: str, password: str, hotelid: str, co
class ReadAction(AlpineBitsAction):
"""Implementation for OTA_Read action."""
@@ -478,7 +484,19 @@ class ReadAction(AlpineBitsAction):
for reservation, customer in reservation_customer_pairs:
_LOGGER.info(f"Reservation: {reservation.id}, Customer: {customer.given_name}")
res_retrive_rs = create_xml_from_db(reservation_customer_pairs)
config = SerializerConfig(
pretty_print=True, xml_declaration=True, encoding="UTF-8"
)
serializer = XmlSerializer(config=config)
response_xml = serializer.render(
res_retrive_rs, ns_map={None: "http://www.opentravel.org/OTA/2003/05"}
)
return AlpineBitsResponse(response_xml, HttpStatusCode.OK)