Extract offer from generic_webhook if set

This commit is contained in:
Jonas Linter
2025-11-20 23:01:04 +01:00
parent ce1fd140c9
commit 1fb698de66

View File

@@ -802,6 +802,20 @@ async def process_generic_webhook_submission(
hotel_data = data.get("hotel_data", {}) hotel_data = data.get("hotel_data", {})
form_data = data.get("form_data", {}) form_data = data.get("form_data", {})
tracking_data = data.get("tracking_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 # Extract hotel information
hotel_code = hotel_data.get("hotelcode") hotel_code = hotel_data.get("hotelcode")
@@ -943,7 +957,7 @@ async def process_generic_webhook_submission(
"children_ages": children_ages, "children_ages": children_ages,
"hotel_code": hotel_code, "hotel_code": hotel_code,
"hotel_name": hotel_name, "hotel_name": hotel_name,
"offer": None, "offer": selected_offers_str,
"utm_source": utm_source, "utm_source": utm_source,
"utm_medium": utm_medium, "utm_medium": utm_medium,
"utm_campaign": utm_campaign, "utm_campaign": utm_campaign,