From d4adfa4ab40225cb96c8cc1d2f1e9169f662a4bf Mon Sep 17 00:00:00 2001 From: Jonas Linter <{email_address}> Date: Thu, 20 Nov 2025 23:01:04 +0100 Subject: [PATCH] Extract offer from generic_webhook if set --- src/alpine_bits_python/api.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/alpine_bits_python/api.py b/src/alpine_bits_python/api.py index b955908..bf06cb2 100644 --- a/src/alpine_bits_python/api.py +++ b/src/alpine_bits_python/api.py @@ -802,6 +802,20 @@ async def process_generic_webhook_submission( hotel_data = data.get("hotel_data", {}) form_data = data.get("form_data", {}) tracking_data = data.get("tracking_data", {}) + offer_data = data.get("unterkunftTyp", {}) + + selected_offers = [] + + if offer_data: + # grab keys and values. If value is "on" add the key not the value to a list of selected offers + + offer_data: dict[str, str] + + for key, value in offer_data.items(): + if value == "on": + selected_offers.append(key) + + selected_offers_str = ", ".join(selected_offers) if selected_offers else None # Extract hotel information hotel_code = hotel_data.get("hotelcode") @@ -943,7 +957,7 @@ async def process_generic_webhook_submission( "children_ages": children_ages, "hotel_code": hotel_code, "hotel_name": hotel_name, - "offer": None, + "offer": selected_offers_str, "utm_source": utm_source, "utm_medium": utm_medium, "utm_campaign": utm_campaign,