Extract offer from generic_webhook if set
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user