From 12072dcbc84411d144a87395174dcb01ea26d95c Mon Sep 17 00:00:00 2001 From: Jonas Linter <{email_address}> Date: Wed, 12 Nov 2025 18:40:37 +0100 Subject: [PATCH] Small fixes --- src/alpine_bits_python/api.py | 20 +- tests/test_api.py | 24 ++ tests/test_data/test_form1.json | 476 +++++++++++++++---------------- tests/test_data/test_form2.json | 477 +++++++++++++++---------------- tests/test_data/test_form3.json | 482 ++++++++++++++++---------------- tests/test_data/test_form4.json | 476 +++++++++++++++---------------- tests/test_data/test_form5.json | 275 ++++++++++++++++++ 7 files changed, 1277 insertions(+), 953 deletions(-) create mode 100644 tests/test_data/test_form5.json diff --git a/src/alpine_bits_python/api.py b/src/alpine_bits_python/api.py index 7ede70c..78a1381 100644 --- a/src/alpine_bits_python/api.py +++ b/src/alpine_bits_python/api.py @@ -560,6 +560,18 @@ async def process_wix_form_submission(request: Request, data: dict[str, Any], db name_prefix = data.get("field:anrede") email_newsletter = data.get("field:form_field_5a7b", False) + + # if email_newsletter is a string, attempt to convert to boolean, else false + if isinstance(email_newsletter, str): + email_newsletter = email_newsletter.lower() in [ + "yes", + "true", + "1", + "on", + "selezionato", + "angekreuzt", + ] + address_line = None city_name = None postal_code = None @@ -585,14 +597,20 @@ async def process_wix_form_submission(request: Request, data: dict[str, Any], db num_children = int(data.get("field:anzahl_kinder") or 0) children_ages = [] if num_children > 0: + # Collect all child age fields, then take only the first num_children + # This handles form updates that may send extra padded/zero fields + temp_ages = [] for k in data: if k.startswith("field:alter_kind_"): try: age = int(data[k]) - children_ages.append(age) + temp_ages.append(age) except ValueError: _LOGGER.warning("Invalid age value for %s: %s", k, data[k]) + # Only keep the first num_children ages, regardless of their values + children_ages = temp_ages[:num_children] + offer = data.get("field:angebot_auswaehlen") # get submissionId and ensure max length 35. Generate one if not present diff --git a/tests/test_api.py b/tests/test_api.py index bf59bf1..e73dabf 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -11,6 +11,7 @@ This module tests all FastAPI endpoints including: import base64 import gzip +import json import uuid from pathlib import Path from unittest.mock import patch @@ -263,6 +264,29 @@ class TestWixWebhookEndpoint: data = response.json() assert data["status"] == "success" + @pytest.mark.parametrize( + "test_form_file", + [ + Path(__file__).parent / "test_data" / f"test_form{i}.json" + for i in range(1, 6) + ], + ids=lambda p: p.name, + ) + def test_wix_webhook_test_endpoint_with_test_forms(self, client, test_form_file): + """Test the test endpoint works with all test form data files.""" + # Skip if file doesn't exist + if not test_form_file.exists(): + pytest.skip(f"{test_form_file.name} not found") + + # Load test form data + with test_form_file.open() as f: + form_data = json.load(f) + + response = client.post("/api/webhook/wix-form/test", json=form_data) + assert response.status_code == HttpStatusCode.OK + data = response.json() + assert data["status"] == "success" + def test_wix_webhook_updates_existing_customer(self, client): """Test that same contact_id updates customer instead of duplicate.""" # First submission diff --git a/tests/test_data/test_form1.json b/tests/test_data/test_form1.json index fe80680..a9eb518 100644 --- a/tests/test_data/test_form1.json +++ b/tests/test_data/test_form1.json @@ -1,241 +1,243 @@ -{"data": { - "formName": "Contact us", - "submissions": [ +{ + "data": { + "formName": "Contact us", + "submissions": [ + { + "label": "Angebot auswählen", + "value": "Zimmer: Doppelzimmer" + }, + { + "label": "Anreisedatum", + "value": "2025-10-21" + }, + { + "label": "Abreisedatum", + "value": "2025-12-28" + }, + { + "label": "Anzahl Erwachsene", + "value": "4" + }, + { + "label": "Anzahl Kinder", + "value": "0" + }, + { + "label": "Anrede", + "value": "Herr" + }, + { + "label": "Vorname", + "value": "Jonas" + }, + { + "label": "Nachname", + "value": "Linter" + }, + { + "label": "Email", + "value": "jonas@vaius.ai" + }, + { + "label": "Phone", + "value": "+39 392 007 6982" + }, + { + "label": "Message", + "value": "Hallo nachricht in der Kommentarsection" + }, + { + "label": "Einwilligung Marketing", + "value": "Angekreuzt" + }, + { + "label": "utm_Source", + "value": "" + }, + { + "label": "utm_Medium", + "value": "" + }, + { + "label": "utm_Campaign", + "value": "" + }, + { + "label": "utm_Term", + "value": "" + }, + { + "label": "utm_Content", + "value": "" + }, + { + "label": "utm_term_id", + "value": "" + }, + { + "label": "utm_content_id", + "value": "" + }, + { + "label": "gad_source", + "value": "5" + }, + { + "label": "gad_campaignid", + "value": "23065043477" + }, + { + "label": "gbraid", + "value": "" + }, + { + "label": "gclid", + "value": "EAIaIQobChMI-d7Bn_-OkAMVuZJQBh09uD0vEAAYASAAEgKR8_D_BwE" + }, + { + "label": "fbclid", + "value": "" + }, + { + "label": "hotelid", + "value": "12345" + }, + { + "label": "hotelname", + "value": "Bemelmans Post" + } + ], + "field:date_picker_7e65": "2025-10-28", + "field:number_7cf5": "2", + "field:utm_source": "", + "submissionTime": "2025-10-06T07:05:34.001Z", + "field:gad_source": "5", + "field:form_field_5a7b": true, + "field:gad_campaignid": "23065043477", + "field:utm_medium": "", + "field:utm_term_id": "", + "context": { + "metaSiteId": "1dea821c-8168-4736-96e4-4b92e8b364cf", + "activationId": "fd8e9c90-0335-4fd2-976d-985f065f3f80" + }, + "field:email_5139": "jonas@vaius.ai", + "field:phone_4c77": "+39 392 007 6982", + "_context": { + "activation": { + "id": "fd8e9c90-0335-4fd2-976d-985f065f3f80" + }, + "configuration": { + "id": "a976f18c-fa86-495d-be1e-676df188eeae" + }, + "app": { + "id": "225dd912-7dea-4738-8688-4b8c6955ffc2" + }, + "action": { + "id": "152db4d7-5263-40c4-be2b-1c81476318b7" + }, + "trigger": { + "key": "wix_form_app-form_submitted" + } + }, + "field:gclid": "nduaitreuditaor", + "formFieldMask": [ + "field:", + "field:", + "field:angebot_auswaehlen", + "field:date_picker_a7c8", + "field:date_picker_7e65", + "field:", + "field:number_7cf5", + "field:anzahl_kinder", + "field:alter_kind_3", + "field:alter_kind_25", + "field:alter_kind_4", + "field:alter_kind_5", + "field:alter_kind_6", + "field:alter_kind_7", + "field:alter_kind_8", + "field:alter_kind_9", + "field:alter_kind_10", + "field:alter_kind_11", + "field:", + "field:anrede", + "field:first_name_abae", + "field:last_name_d97c", + "field:email_5139", + "field:phone_4c77", + "field:long_answer_3524", + "field:form_field_5a7b", + "field:", + "field:utm_source", + "field:utm_medium", + "field:utm_campaign", + "field:utm_term", + "field:utm_content", + "field:utm_term_id", + "field:utm_content_id", + "field:gad_source", + "field:gad_campaignid", + "field:gbraid", + "field:gclid", + "field:fbclid", + "field:hotelid", + "field:hotelname", + "field:", + "metaSiteId" + ], + "contact": { + "name": { + "first": "Jonas", + "last": "Linter" + }, + "email": "jonas@vaius.ai", + "locale": "de-de", + "phones": [ { - "label": "Angebot auswählen", - "value": "Zimmer: Doppelzimmer" - }, - { - "label": "Anreisedatum", - "value": "2025-10-21" - }, - { - "label": "Abreisedatum", - "value": "2025-12-28" - }, - { - "label": "Anzahl Erwachsene", - "value": "4" - }, - { - "label": "Anzahl Kinder", - "value": "0" - }, - { - "label": "Anrede", - "value": "Herr" - }, - { - "label": "Vorname", - "value": "Jonas" - }, - { - "label": "Nachname", - "value": "Linter" - }, - { - "label": "Email", - "value": "jonas@vaius.ai" - }, - { - "label": "Phone", - "value": "+39 392 007 6982" - }, - { - "label": "Message", - "value": "Hallo nachricht in der Kommentarsection" - }, - { - "label": "Einwilligung Marketing", - "value": "Angekreuzt" - }, - { - "label": "utm_Source", - "value": "" - }, - { - "label": "utm_Medium", - "value": "" - }, - { - "label": "utm_Campaign", - "value": "" - }, - { - "label": "utm_Term", - "value": "" - }, - { - "label": "utm_Content", - "value": "" - }, - { - "label": "utm_term_id", - "value": "" - }, - { - "label": "utm_content_id", - "value": "" - }, - { - "label": "gad_source", - "value": "5" - }, - { - "label": "gad_campaignid", - "value": "23065043477" - }, - { - "label": "gbraid", - "value": "" - }, - { - "label": "gclid", - "value": "EAIaIQobChMI-d7Bn_-OkAMVuZJQBh09uD0vEAAYASAAEgKR8_D_BwE" - }, - { - "label": "fbclid", - "value": "" - }, - { - "label": "hotelid", - "value": "12345" - }, - { - "label": "hotelname", - "value": "Bemelmans Post" + "tag": "UNTAGGED", + "formattedPhone": "+393920076982", + "id": "a3bf4-6dbe-4611-8963-a50df805785d", + "countryCode": "DE", + "e164Phone": "+393920076982", + "primary": true, + "phone": "392 0076982" } ], - "field:date_picker_7e65": "2025-10-28", - "field:number_7cf5": "2", - "field:utm_source": "", - "submissionTime": "2025-10-06T07:05:34.001Z", - "field:gad_source": "5", - "field:form_field_5a7b": "Angekreuzt", - "field:gad_campaignid": "23065043477", - "field:utm_medium": "", - "field:utm_term_id": "", - "context": { - "metaSiteId": "1dea821c-8168-4736-96e4-4b92e8b364cf", - "activationId": "fd8e9c90-0335-4fd2-976d-985f065f3f80" - }, - "field:email_5139": "jonas@vaius.ai", - "field:phone_4c77": "+39 392 007 6982", - "_context": { - "activation": { - "id": "fd8e9c90-0335-4fd2-976d-985f065f3f80" - }, - "configuration": { - "id": "a976f18c-fa86-495d-be1e-676df188eeae" - }, - "app": { - "id": "225dd912-7dea-4738-8688-4b8c6955ffc2" - }, - "action": { - "id": "152db4d7-5263-40c4-be2b-1c81476318b7" - }, - "trigger": { - "key": "wix_form_app-form_submitted" - } - }, - "field:gclid": "nduaitreuditaor", - "formFieldMask": [ - "field:", - "field:", - "field:angebot_auswaehlen", - "field:date_picker_a7c8", - "field:date_picker_7e65", - "field:", - "field:number_7cf5", - "field:anzahl_kinder", - "field:alter_kind_3", - "field:alter_kind_25", - "field:alter_kind_4", - "field:alter_kind_5", - "field:alter_kind_6", - "field:alter_kind_7", - "field:alter_kind_8", - "field:alter_kind_9", - "field:alter_kind_10", - "field:alter_kind_11", - "field:", - "field:anrede", - "field:first_name_abae", - "field:last_name_d97c", - "field:email_5139", - "field:phone_4c77", - "field:long_answer_3524", - "field:form_field_5a7b", - "field:", - "field:utm_source", - "field:utm_medium", - "field:utm_campaign", - "field:utm_term", - "field:utm_content", - "field:utm_term_id", - "field:utm_content_id", - "field:gad_source", - "field:gad_campaignid", - "field:gbraid", - "field:gclid", - "field:fbclid", - "field:hotelid", - "field:hotelname", - "field:", - "metaSiteId" - ], - "contact": { - "name": { - "first": "Jonas", - "last": "Linter" - }, - "email": "jonas@vaius.ai", - "locale": "de-de", - "phones": [ - { - "tag": "UNTAGGED", - "formattedPhone": "+393920076982", - "id": "a3bf4-6dbe-4611-8963-a50df805785d", - "countryCode": "DE", - "e164Phone": "+393920076982", - "primary": true, - "phone": "392 0076982" - } - ], - "contactId": "66659da8-4035-47fe-a66b-6ce461ad290f", - "emails": [ - { - "id": "e1d2168e-ca3c-4844-8f93-f2e1b0ae70e3", - "tag": "UNTAGGED", - "email": "koepper-ed@t-online.de", - "primary": true - } - ], - "updatedDate": "2025-10-06T07:05:35.675Z", - "phone": "+491758555456", - "createdDate": "2025-10-06T07:05:35.675Z" - }, - "submissionId": "666247dc-9d5a-4eb7-87a7-677bf64645ad", - "field:anzahl_kinder": "0", - "field:first_name_abae": "Ernst-Dieter", - "field:utm_content_id": "", - "field:utm_campaign": "", - "field:utm_term": "", "contactId": "66659da8-4035-47fe-a66b-6ce461ad290f", - "field:date_picker_a7c8": "2025-12-21", - "field:hotelname": "Testhotel", - "field:angebot_auswaehlen": "Zimmer: Doppelzimmer", - "field:utm_content": "", - "field:last_name_d97c": "Linter", - "field:hotelid": "135", - "submissionsLink": "https://manage.wix.app/forms/submissions/1dea821c-8168-4736-96e4-4b92e8b364cf/e084006b-ae83-4e4d-b2f5-074118cdb3b1?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F1dea821c-8168-4736-96e4-4b92e8b364cf%2Fwix-forms%2Fform%2Fe084006b-ae83-4e4d-b2f5-074118cdb3b1%2Fsubmissions&s=true", - "field:gbraid": "", - "field:fbclid": "", - "submissionPdf": { - "fileName": "86d247dc-9d5a-4eb7-87a7-677bf64645ad.pdf", - "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/86d247dc-9d5a-4eb7-87a7-677bf64645ad/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiMWRlYTgyMWMtODE2OC00NzM2LTk2ZTQtNGI5MmU4YjM2NGNmXCJ9IiwiaWF0IjoxNzU5NzM0MzM1LCJleHAiOjE3NTk3MzQ5MzV9.9koy-O_ptm0dRspjh01Yefkt2rCHiUlRCFtE_S3auYw" - }, - "field:anrede": "Herr", - "field:long_answer_3524": "Kommentarsektion vermutlich", - "formId": "e084006b-ae83-4e4d-b2f5-074118cdb3b1" - }} \ No newline at end of file + "emails": [ + { + "id": "e1d2168e-ca3c-4844-8f93-f2e1b0ae70e3", + "tag": "UNTAGGED", + "email": "koepper-ed@t-online.de", + "primary": true + } + ], + "updatedDate": "2025-10-06T07:05:35.675Z", + "phone": "+491758555456", + "createdDate": "2025-10-06T07:05:35.675Z" + }, + "submissionId": "666247dc-9d5a-4eb7-87a7-677bf64645ad", + "field:anzahl_kinder": "0", + "field:first_name_abae": "Ernst-Dieter", + "field:utm_content_id": "", + "field:utm_campaign": "", + "field:utm_term": "", + "contactId": "66659da8-4035-47fe-a66b-6ce461ad290f", + "field:date_picker_a7c8": "2025-12-21", + "field:hotelname": "Testhotel", + "field:angebot_auswaehlen": "Zimmer: Doppelzimmer", + "field:utm_content": "", + "field:last_name_d97c": "Linter", + "field:hotelid": "135", + "submissionsLink": "https://manage.wix.app/forms/submissions/1dea821c-8168-4736-96e4-4b92e8b364cf/e084006b-ae83-4e4d-b2f5-074118cdb3b1?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F1dea821c-8168-4736-96e4-4b92e8b364cf%2Fwix-forms%2Fform%2Fe084006b-ae83-4e4d-b2f5-074118cdb3b1%2Fsubmissions&s=true", + "field:gbraid": "", + "field:fbclid": "", + "submissionPdf": { + "fileName": "86d247dc-9d5a-4eb7-87a7-677bf64645ad.pdf", + "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/86d247dc-9d5a-4eb7-87a7-677bf64645ad/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiMWRlYTgyMWMtODE2OC00NzM2LTk2ZTQtNGI5MmU4YjM2NGNmXCJ9IiwiaWF0IjoxNzU5NzM0MzM1LCJleHAiOjE3NTk3MzQ5MzV9.9koy-O_ptm0dRspjh01Yefkt2rCHiUlRCFtE_S3auYw" + }, + "field:anrede": "Herr", + "field:long_answer_3524": "Kommentarsektion vermutlich", + "formId": "e084006b-ae83-4e4d-b2f5-074118cdb3b1" + } +} diff --git a/tests/test_data/test_form2.json b/tests/test_data/test_form2.json index b266087..a696187 100644 --- a/tests/test_data/test_form2.json +++ b/tests/test_data/test_form2.json @@ -1,242 +1,243 @@ -{"data": { - "formName": "Reservation Request", - "submissions": [ +{ + "data": { + "formName": "Reservation Request", + "submissions": [ + { + "label": "Angebot auswählen", + "value": "Zimmer: Einzelzimmer" + }, + { + "label": "Anreisedatum", + "value": "2025-11-15" + }, + { + "label": "Abreisedatum", + "value": "2025-11-18" + }, + { + "label": "Anzahl Erwachsene", + "value": "1" + }, + { + "label": "Anzahl Kinder", + "value": "1" + }, + { + "label": "Anrede", + "value": "Frau" + }, + { + "label": "Vorname", + "value": "Maria" + }, + { + "label": "Nachname", + "value": "Schmidt" + }, + { + "label": "Email", + "value": "maria.schmidt@gmail.com" + }, + { + "label": "Phone", + "value": "+49 173 555 1234" + }, + { + "label": "Message", + "value": "Benötige ein ruhiges Zimmer, bitte." + }, + { + "label": "Einwilligung Marketing", + "value": "Selezionato" + }, + { + "label": "utm_Source", + "value": "google" + }, + { + "label": "utm_Medium", + "value": "cpc" + }, + { + "label": "utm_Campaign", + "value": "winter_2025" + }, + { + "label": "utm_Term", + "value": "hotel_booking" + }, + { + "label": "utm_Content", + "value": "ad_variant_a" + }, + { + "label": "utm_term_id", + "value": "12345" + }, + { + "label": "utm_content_id", + "value": "67890" + }, + { + "label": "gad_source", + "value": "1" + }, + { + "label": "gad_campaignid", + "value": "98765432" + }, + { + "label": "gbraid", + "value": "1.2.abc123def456" + }, + { + "label": "gclid", + "value": "CjwKCAjw9eWYBhB3EiwAA5J8_xyz123abc" + }, + { + "label": "fbclid", + "value": "IwAR123fbclid456" + }, + { + "label": "hotelid", + "value": "135" + }, + { + "label": "hotelname", + "value": "Frangart Inn" + } + ], + "field:date_picker_7e65": "2025-11-18", + "field:number_7cf5": "1", + "field:utm_source": "google", + "submissionTime": "2025-10-06T14:22:15.001Z", + "field:gad_source": "1", + "field:gad_campaignid": "98765432", + "field:utm_medium": "cpc", + "field:utm_term_id": "12345", + "context": { + "metaSiteId": "2ebc832d-9279-5847-a7f5-5c03f9c475d0", + "activationId": "0e9a0d91-1446-5fe3-a87e-a96b17f720c1" + }, + "field:email_5139": "maria.schmidt@gmail.com", + "field:phone_4c77": "+49 173 555 1234", + "_context": { + "activation": { + "id": "0e9a0d91-1446-5fe3-a87e-a96b17f720c1" + }, + "configuration": { + "id": "b087029d-0b97-506e-cf2f-787e0299ffbf" + }, + "app": { + "id": "336ee023-8efa-5849-9799-5c9d7066aac3" + }, + "action": { + "id": "263ec5e8-6374-51d5-df3c-2d92587429c8" + }, + "trigger": { + "key": "wix_form_app-form_submitted" + } + }, + "field:gclid": "CjwKCAjw9eWYBhB3EiwAA5J8_xyz123abc", + "formFieldMask": [ + "field:", + "field:", + "field:angebot_auswaehlen", + "field:date_picker_a7c8", + "field:date_picker_7e65", + "field:", + "field:number_7cf5", + "field:anzahl_kinder", + "field:alter_kind_3", + "field:alter_kind_25", + "field:alter_kind_4", + "field:alter_kind_5", + "field:alter_kind_6", + "field:alter_kind_7", + "field:alter_kind_8", + "field:alter_kind_9", + "field:alter_kind_10", + "field:alter_kind_11", + "field:", + "field:anrede", + "field:first_name_abae", + "field:last_name_d97c", + "field:email_5139", + "field:phone_4c77", + "field:long_answer_3524", + "field:form_field_5a7b", + "field:", + "field:utm_source", + "field:utm_medium", + "field:utm_campaign", + "field:utm_term", + "field:utm_content", + "field:utm_term_id", + "field:utm_content_id", + "field:gad_source", + "field:gad_campaignid", + "field:gbraid", + "field:gclid", + "field:fbclid", + "field:hotelid", + "field:hotelname", + "field:", + "metaSiteId" + ], + "contact": { + "name": { + "first": "Maria", + "last": "Schmidt" + }, + "email": "maria.schmidt@gmail.com", + "locale": "de-de", + "phones": [ { - "label": "Angebot auswählen", - "value": "Zimmer: Einzelzimmer" - }, - { - "label": "Anreisedatum", - "value": "2025-11-15" - }, - { - "label": "Abreisedatum", - "value": "2025-11-18" - }, - { - "label": "Anzahl Erwachsene", - "value": "1" - }, - { - "label": "Anzahl Kinder", - "value": "1" - }, - { - "label": "Anrede", - "value": "Frau" - }, - { - "label": "Vorname", - "value": "Maria" - }, - { - "label": "Nachname", - "value": "Schmidt" - }, - { - "label": "Email", - "value": "maria.schmidt@gmail.com" - }, - { - "label": "Phone", - "value": "+49 173 555 1234" - }, - { - "label": "Message", - "value": "Benötige ein ruhiges Zimmer, bitte." - }, - { - "label": "Einwilligung Marketing", - "value": "Selezionato" - }, - { - "label": "utm_Source", - "value": "google" - }, - { - "label": "utm_Medium", - "value": "cpc" - }, - { - "label": "utm_Campaign", - "value": "winter_2025" - }, - { - "label": "utm_Term", - "value": "hotel_booking" - }, - { - "label": "utm_Content", - "value": "ad_variant_a" - }, - { - "label": "utm_term_id", - "value": "12345" - }, - { - "label": "utm_content_id", - "value": "67890" - }, - { - "label": "gad_source", - "value": "1" - }, - { - "label": "gad_campaignid", - "value": "98765432" - }, - { - "label": "gbraid", - "value": "1.2.abc123def456" - }, - { - "label": "gclid", - "value": "CjwKCAjw9eWYBhB3EiwAA5J8_xyz123abc" - }, - { - "label": "fbclid", - "value": "IwAR123fbclid456" - }, - { - "label": "hotelid", - "value": "135" - }, - { - "label": "hotelname", - "value": "Frangart Inn" + "tag": "UNTAGGED", + "formattedPhone": "+49 173 555 1234", + "id": "641b4cf5-7ecf-5722-9a74-b61ea916391e", + "countryCode": "DE", + "e164Phone": "+393920076982", + "primary": true, + "phone": "173 5551234" } ], - "field:date_picker_7e65": "2025-11-18", - "field:number_7cf5": "1", - "field:utm_source": "google", - "submissionTime": "2025-10-06T14:22:15.001Z", - "field:gad_source": "1", - "field:form_field_5a7b": "Selezionato", - "field:gad_campaignid": "98765432", - "field:utm_medium": "cpc", - "field:utm_term_id": "12345", - "context": { - "metaSiteId": "2ebc832d-9279-5847-a7f5-5c03f9c475d0", - "activationId": "0e9a0d91-1446-5fe3-a87e-a96b17f720c1" - }, - "field:email_5139": "maria.schmidt@gmail.com", - "field:phone_4c77": "+49 173 555 1234", - "_context": { - "activation": { - "id": "0e9a0d91-1446-5fe3-a87e-a96b17f720c1" - }, - "configuration": { - "id": "b087029d-0b97-506e-cf2f-787e0299ffbf" - }, - "app": { - "id": "336ee023-8efa-5849-9799-5c9d7066aac3" - }, - "action": { - "id": "263ec5e8-6374-51d5-df3c-2d92587429c8" - }, - "trigger": { - "key": "wix_form_app-form_submitted" - } - }, - "field:gclid": "CjwKCAjw9eWYBhB3EiwAA5J8_xyz123abc", - "formFieldMask": [ - "field:", - "field:", - "field:angebot_auswaehlen", - "field:date_picker_a7c8", - "field:date_picker_7e65", - "field:", - "field:number_7cf5", - "field:anzahl_kinder", - "field:alter_kind_3", - "field:alter_kind_25", - "field:alter_kind_4", - "field:alter_kind_5", - "field:alter_kind_6", - "field:alter_kind_7", - "field:alter_kind_8", - "field:alter_kind_9", - "field:alter_kind_10", - "field:alter_kind_11", - "field:", - "field:anrede", - "field:first_name_abae", - "field:last_name_d97c", - "field:email_5139", - "field:phone_4c77", - "field:long_answer_3524", - "field:form_field_5a7b", - "field:", - "field:utm_source", - "field:utm_medium", - "field:utm_campaign", - "field:utm_term", - "field:utm_content", - "field:utm_term_id", - "field:utm_content_id", - "field:gad_source", - "field:gad_campaignid", - "field:gbraid", - "field:gclid", - "field:fbclid", - "field:hotelid", - "field:hotelname", - "field:", - "metaSiteId" - ], - "contact": { - "name": { - "first": "Maria", - "last": "Schmidt" - }, - "email": "maria.schmidt@gmail.com", - "locale": "de-de", - "phones": [ - { - "tag": "UNTAGGED", - "formattedPhone": "+49 173 555 1234", - "id": "641b4cf5-7ecf-5722-9a74-b61ea916391e", - "countryCode": "DE", - "e164Phone": "+393920076982", - "primary": true, - "phone": "173 5551234" - } - ], - "contactId": "24760eb9-5146-58f0-b77c-7df572be401f", - "emails": [ - { - "id": "f2e3279f-db4d-5955-90a4-03f2c1bf81f4", - "tag": "UNTAGGED", - "email": "maria.schmidt@gmail.com", - "primary": true - } - ], - "updatedDate": "2025-10-06T14:22:16.675Z", - "phone": "+393920076982", - "createdDate": "2025-10-06T14:22:16.675Z" - }, - "submissionId": "97e358ed-ae6b-5fc8-98c8-788cf75756be", - "field:anzahl_kinder": "1", - "field:first_name_abae": "Maria", - "field:utm_content_id": "67890", - "field:utm_campaign": "winter_2025", - "field:utm_term": "hotel_booking", "contactId": "24760eb9-5146-58f0-b77c-7df572be401f", - "field:date_picker_a7c8": "2025-11-15", - "field:hotelname": "Frangart Inn", - "field:angebot_auswaehlen": "Zimmer: Einzelzimmer", - "field:utm_content": "ad_variant_a", - "field:last_name_d97c": "Schmidt", - "field:hotelid": "135", - "field:alter_kind_3": "8", - "submissionsLink": "https://manage.wix.app/forms/submissions/2ebc832d-9279-5847-a7f5-5c03f9c475d0/f195117c-bf94-5f5e-c6g6-185229dde4c2?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F2ebc832d-9279-5847-a7f5-5c03f9c475d0%2Fwix-forms%2Fform%2Ff195117c-bf94-5f5e-c6g6-185229dde4c2%2Fsubmissions&s=true", - "field:gbraid": "1.2.abc123def456", - "field:fbclid": "IwAR123fbclid456", - "submissionPdf": { - "fileName": "97e358ed-ae6b-5fc8-98c8-788cf75756be.pdf", - "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/97e358ed-ae6b-5fc8-98c8-788cf75756be/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiMmViYzgzMmQtOTI3OS01ODQ3LWE3ZjUtNWMwM2Y5YzQ3NWQwXCJ9IiwiaWF0IjoxNzU5ODQ1MzM2LCJleHAiOjE3NTk4NDU5MzZ9.abc123_different_token_here" - }, - "field:anrede": "Frau", - "field:long_answer_3524": "Benötige ein ruhiges Zimmer, bitte.", - "formId": "f195117c-bf94-5f5e-c6g6-185229dde4c2" - }} \ No newline at end of file + "emails": [ + { + "id": "f2e3279f-db4d-5955-90a4-03f2c1bf81f4", + "tag": "UNTAGGED", + "email": "maria.schmidt@gmail.com", + "primary": true + } + ], + "updatedDate": "2025-10-06T14:22:16.675Z", + "phone": "+393920076982", + "createdDate": "2025-10-06T14:22:16.675Z" + }, + "submissionId": "97e358ed-ae6b-5fc8-98c8-788cf75756be", + "field:anzahl_kinder": "1", + "field:first_name_abae": "Maria", + "field:utm_content_id": "67890", + "field:utm_campaign": "winter_2025", + "field:utm_term": "hotel_booking", + "contactId": "24760eb9-5146-58f0-b77c-7df572be401f", + "field:date_picker_a7c8": "2025-11-15", + "field:hotelname": "Frangart Inn", + "field:angebot_auswaehlen": "Zimmer: Einzelzimmer", + "field:utm_content": "ad_variant_a", + "field:last_name_d97c": "Schmidt", + "field:hotelid": "135", + "field:alter_kind_3": "8", + "submissionsLink": "https://manage.wix.app/forms/submissions/2ebc832d-9279-5847-a7f5-5c03f9c475d0/f195117c-bf94-5f5e-c6g6-185229dde4c2?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F2ebc832d-9279-5847-a7f5-5c03f9c475d0%2Fwix-forms%2Fform%2Ff195117c-bf94-5f5e-c6g6-185229dde4c2%2Fsubmissions&s=true", + "field:gbraid": "1.2.abc123def456", + "field:fbclid": "IwAR123fbclid456", + "submissionPdf": { + "fileName": "97e358ed-ae6b-5fc8-98c8-788cf75756be.pdf", + "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/97e358ed-ae6b-5fc8-98c8-788cf75756be/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiMmViYzgzMmQtOTI3OS01ODQ3LWE3ZjUtNWMwM2Y5YzQ3NWQwXCJ9IiwiaWF0IjoxNzU5ODQ1MzM2LCJleHAiOjE3NTk4NDU5MzZ9.abc123_different_token_here" + }, + "field:anrede": "Frau", + "field:long_answer_3524": "Benötige ein ruhiges Zimmer, bitte.", + "formId": "f195117c-bf94-5f5e-c6g6-185229dde4c2" + } +} diff --git a/tests/test_data/test_form3.json b/tests/test_data/test_form3.json index 1db75fc..8a37ff8 100644 --- a/tests/test_data/test_form3.json +++ b/tests/test_data/test_form3.json @@ -1,244 +1,246 @@ -{"data": { - "formName": "Family Vacation Inquiry", - "submissions": [ +{ + "data": { + "formName": "Family Vacation Inquiry", + "submissions": [ + { + "label": "Angebot auswählen", + "value": "Suite: Familiensuite" + }, + { + "label": "Anreisedatum", + "value": "2025-12-20" + }, + { + "label": "Abreisedatum", + "value": "2025-12-27" + }, + { + "label": "Anzahl Erwachsene", + "value": "2" + }, + { + "label": "Anzahl Kinder", + "value": "3" + }, + { + "label": "Anrede", + "value": "Herr" + }, + { + "label": "Vorname", + "value": "Alessandro" + }, + { + "label": "Nachname", + "value": "Rossi" + }, + { + "label": "Email", + "value": "alessandro.rossi@example.it" + }, + { + "label": "Phone", + "value": "+39 348 123 4567" + }, + { + "label": "Message", + "value": "Wir planen unseren Weihnachtsurlaub mit drei Kindern. Brauchen Kinderbetten und Nähe zum Spielplatz." + }, + { + "label": "Einwilligung Marketing", + "value": "Angekreuzt" + }, + { + "label": "utm_Source", + "value": "facebook" + }, + { + "label": "utm_Medium", + "value": "social" + }, + { + "label": "utm_Campaign", + "value": "christmas_special" + }, + { + "label": "utm_Term", + "value": "family_hotel" + }, + { + "label": "utm_Content", + "value": "carousel_ad" + }, + { + "label": "utm_term_id", + "value": "54321" + }, + { + "label": "utm_content_id", + "value": "09876" + }, + { + "label": "gad_source", + "value": "" + }, + { + "label": "gad_campaignid", + "value": "" + }, + { + "label": "gbraid", + "value": "" + }, + { + "label": "gclid", + "value": "" + }, + { + "label": "fbclid", + "value": "IwAR3xHcVb6eJbMqQ_fbsocial789" + }, + { + "label": "hotelid", + "value": "135" + }, + { + "label": "hotelname", + "value": "Bemelmans" + } + ], + "field:date_picker_7e65": "2025-12-27", + "field:number_7cf5": "2", + "field:utm_source": "facebook", + "submissionTime": "2025-10-06T16:45:22.001Z", + "field:gad_source": "", + "field:form_field_5a7b": false, + "field:gad_campaignid": "", + "field:utm_medium": "social", + "field:utm_term_id": "54321", + "context": { + "metaSiteId": "3fcd943e-a38a-6958-b8g6-6d14gad586e1", + "activationId": "1f0b1e02-2557-6gf4-b98f-ba7c28g831d2" + }, + "field:email_5139": "alessandro.rossi@example.it", + "field:phone_4c77": "+39 348 123 4567", + "_context": { + "activation": { + "id": "1f0b1e02-2557-6gf4-b98f-ba7c28g831d2" + }, + "configuration": { + "id": "c198130e-1ca8-617f-dg3g-898f1300ggcg" + }, + "app": { + "id": "447ff134-9g0b-6950-a8aa-6d0e8177bbdc" + }, + "action": { + "id": "374fd6f9-7485-62e6-eg4d-3e03698540d9" + }, + "trigger": { + "key": "wix_form_app-form_submitted" + } + }, + "field:gclid": "", + "formFieldMask": [ + "field:", + "field:", + "field:angebot_auswaehlen", + "field:date_picker_a7c8", + "field:date_picker_7e65", + "field:", + "field:number_7cf5", + "field:anzahl_kinder", + "field:alter_kind_3", + "field:alter_kind_25", + "field:alter_kind_4", + "field:alter_kind_5", + "field:alter_kind_6", + "field:alter_kind_7", + "field:alter_kind_8", + "field:alter_kind_9", + "field:alter_kind_10", + "field:alter_kind_11", + "field:", + "field:anrede", + "field:first_name_abae", + "field:last_name_d97c", + "field:email_5139", + "field:phone_4c77", + "field:long_answer_3524", + "field:form_field_5a7b", + "field:", + "field:utm_source", + "field:utm_medium", + "field:utm_campaign", + "field:utm_term", + "field:utm_content", + "field:utm_term_id", + "field:utm_content_id", + "field:gad_source", + "field:gad_campaignid", + "field:gbraid", + "field:gclid", + "field:fbclid", + "field:hotelid", + "field:hotelname", + "field:", + "metaSiteId" + ], + "contact": { + "name": { + "first": "Alessandro", + "last": "Rossi" + }, + "email": "alessandro.rossi@example.it", + "locale": "it-it", + "phones": [ { - "label": "Angebot auswählen", - "value": "Suite: Familiensuite" - }, - { - "label": "Anreisedatum", - "value": "2025-12-20" - }, - { - "label": "Abreisedatum", - "value": "2025-12-27" - }, - { - "label": "Anzahl Erwachsene", - "value": "2" - }, - { - "label": "Anzahl Kinder", - "value": "3" - }, - { - "label": "Anrede", - "value": "Herr" - }, - { - "label": "Vorname", - "value": "Alessandro" - }, - { - "label": "Nachname", - "value": "Rossi" - }, - { - "label": "Email", - "value": "alessandro.rossi@example.it" - }, - { - "label": "Phone", - "value": "+39 348 123 4567" - }, - { - "label": "Message", - "value": "Wir planen unseren Weihnachtsurlaub mit drei Kindern. Brauchen Kinderbetten und Nähe zum Spielplatz." - }, - { - "label": "Einwilligung Marketing", - "value": "Angekreuzt" - }, - { - "label": "utm_Source", - "value": "facebook" - }, - { - "label": "utm_Medium", - "value": "social" - }, - { - "label": "utm_Campaign", - "value": "christmas_special" - }, - { - "label": "utm_Term", - "value": "family_hotel" - }, - { - "label": "utm_Content", - "value": "carousel_ad" - }, - { - "label": "utm_term_id", - "value": "54321" - }, - { - "label": "utm_content_id", - "value": "09876" - }, - { - "label": "gad_source", - "value": "" - }, - { - "label": "gad_campaignid", - "value": "" - }, - { - "label": "gbraid", - "value": "" - }, - { - "label": "gclid", - "value": "" - }, - { - "label": "fbclid", - "value": "IwAR3xHcVb6eJbMqQ_fbsocial789" - }, - { - "label": "hotelid", - "value": "135" - }, - { - "label": "hotelname", - "value": "Bemelmans" + "tag": "UNTAGGED", + "formattedPhone": "+39 348 123 4567", + "id": "752c5dg6-8fdf-6833-ab85-c72fb027402f", + "countryCode": "IT", + "e164Phone": "+393481234567", + "primary": true, + "phone": "348 1234567" } ], - "field:date_picker_7e65": "2025-12-27", - "field:number_7cf5": "2", - "field:utm_source": "facebook", - "submissionTime": "2025-10-06T16:45:22.001Z", - "field:gad_source": "", - "field:form_field_5a7b": "Angekreuzt", - "field:gad_campaignid": "", - "field:utm_medium": "social", - "field:utm_term_id": "54321", - "context": { - "metaSiteId": "3fcd943e-a38a-6958-b8g6-6d14gad586e1", - "activationId": "1f0b1e02-2557-6gf4-b98f-ba7c28g831d2" - }, - "field:email_5139": "alessandro.rossi@example.it", - "field:phone_4c77": "+39 348 123 4567", - "_context": { - "activation": { - "id": "1f0b1e02-2557-6gf4-b98f-ba7c28g831d2" - }, - "configuration": { - "id": "c198130e-1ca8-617f-dg3g-898f1300ggcg" - }, - "app": { - "id": "447ff134-9g0b-6950-a8aa-6d0e8177bbdc" - }, - "action": { - "id": "374fd6f9-7485-62e6-eg4d-3e03698540d9" - }, - "trigger": { - "key": "wix_form_app-form_submitted" - } - }, - "field:gclid": "", - "formFieldMask": [ - "field:", - "field:", - "field:angebot_auswaehlen", - "field:date_picker_a7c8", - "field:date_picker_7e65", - "field:", - "field:number_7cf5", - "field:anzahl_kinder", - "field:alter_kind_3", - "field:alter_kind_25", - "field:alter_kind_4", - "field:alter_kind_5", - "field:alter_kind_6", - "field:alter_kind_7", - "field:alter_kind_8", - "field:alter_kind_9", - "field:alter_kind_10", - "field:alter_kind_11", - "field:", - "field:anrede", - "field:first_name_abae", - "field:last_name_d97c", - "field:email_5139", - "field:phone_4c77", - "field:long_answer_3524", - "field:form_field_5a7b", - "field:", - "field:utm_source", - "field:utm_medium", - "field:utm_campaign", - "field:utm_term", - "field:utm_content", - "field:utm_term_id", - "field:utm_content_id", - "field:gad_source", - "field:gad_campaignid", - "field:gbraid", - "field:gclid", - "field:fbclid", - "field:hotelid", - "field:hotelname", - "field:", - "metaSiteId" - ], - "contact": { - "name": { - "first": "Alessandro", - "last": "Rossi" - }, - "email": "alessandro.rossi@example.it", - "locale": "it-it", - "phones": [ - { - "tag": "UNTAGGED", - "formattedPhone": "+39 348 123 4567", - "id": "752c5dg6-8fdf-6833-ab85-c72fb027402f", - "countryCode": "IT", - "e164Phone": "+393481234567", - "primary": true, - "phone": "348 1234567" - } - ], - "contactId": "35871fca-6257-69g1-c88d-8eg683cf512g", - "emails": [ - { - "id": "g3f4380g-ec5e-6a66-a1b5-14g3d2cg92g5", - "tag": "UNTAGGED", - "email": "alessandro.rossi@example.it", - "primary": true - } - ], - "updatedDate": "2025-10-06T16:45:23.675Z", - "phone": "+393481234567", - "createdDate": "2025-10-06T16:45:23.675Z" - }, - "submissionId": "a8g469fe-bf7c-6gd9-a9d9-899dg86867cf", - "field:anzahl_kinder": "3", - "field:first_name_abae": "Alessandro", - "field:utm_content_id": "09876", - "field:utm_campaign": "christmas_special", - "field:utm_term": "family_hotel", "contactId": "35871fca-6257-69g1-c88d-8eg683cf512g", - "field:date_picker_a7c8": "2025-12-20", - "field:hotelname": "Bemelmans", - "field:angebot_auswaehlen": "Suite: Familiensuite", - "field:utm_content": "carousel_ad", - "field:last_name_d97c": "Rossi", - "field:hotelid": "135", - "field:alter_kind_3": "12", - "field:alter_kind_4": "9", - "field:alter_kind_5": "6", - "submissionsLink": "https://manage.wix.app/forms/submissions/3fcd943e-a38a-6958-b8g6-6d14gad586e1/g206228d-ch05-6g6f-d7h7-296330eef5d3?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F3fcd943e-a38a-6958-b8g6-6d14gad586e1%2Fwix-forms%2Fform%2Fg206228d-ch05-6g6f-d7h7-296330eef5d3%2Fsubmissions&s=true", - "field:gbraid": "", - "field:fbclid": "IwAR3xHcVb6eJbMqQ_fbsocial789", - "submissionPdf": { - "fileName": "a8g469fe-bf7c-6gd9-a9d9-899dg86867cf.pdf", - "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/a8g469fe-bf7c-6gd9-a9d9-899dg86867cf/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiM2ZjZDk0M2UtYTM4YS02OTU4LWI4ZzYtNmQxNGdhZDU4NmUxXCJ9IiwiaWF0IjoxNzU5ODUyMDQ3LCJleHAiOjE3NTk4NTI2NDd9.xyz789_another_token_here" - }, - "field:anrede": "Herr", - "field:long_answer_3524": "Wir planen unseren Weihnachtsurlaub mit drei Kindern. Brauchen Kinderbetten und Nähe zum Spielplatz.", - "formId": "g206228d-ch05-6g6f-d7h7-296330eef5d3" - }} \ No newline at end of file + "emails": [ + { + "id": "g3f4380g-ec5e-6a66-a1b5-14g3d2cg92g5", + "tag": "UNTAGGED", + "email": "alessandro.rossi@example.it", + "primary": true + } + ], + "updatedDate": "2025-10-06T16:45:23.675Z", + "phone": "+393481234567", + "createdDate": "2025-10-06T16:45:23.675Z" + }, + "submissionId": "a8g469fe-bf7c-6gd9-a9d9-899dg86867cf", + "field:anzahl_kinder": "3", + "field:first_name_abae": "Alessandro", + "field:utm_content_id": "09876", + "field:utm_campaign": "christmas_special", + "field:utm_term": "family_hotel", + "contactId": "35871fca-6257-69g1-c88d-8eg683cf512g", + "field:date_picker_a7c8": "2025-12-20", + "field:hotelname": "Bemelmans", + "field:angebot_auswaehlen": "Suite: Familiensuite", + "field:utm_content": "carousel_ad", + "field:last_name_d97c": "Rossi", + "field:hotelid": "135", + "field:alter_kind_3": "12", + "field:alter_kind_4": "9", + "field:alter_kind_5": "6", + "submissionsLink": "https://manage.wix.app/forms/submissions/3fcd943e-a38a-6958-b8g6-6d14gad586e1/g206228d-ch05-6g6f-d7h7-296330eef5d3?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F3fcd943e-a38a-6958-b8g6-6d14gad586e1%2Fwix-forms%2Fform%2Fg206228d-ch05-6g6f-d7h7-296330eef5d3%2Fsubmissions&s=true", + "field:gbraid": "", + "field:fbclid": "IwAR3xHcVb6eJbMqQ_fbsocial789", + "submissionPdf": { + "fileName": "a8g469fe-bf7c-6gd9-a9d9-899dg86867cf.pdf", + "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/a8g469fe-bf7c-6gd9-a9d9-899dg86867cf/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiM2ZjZDk0M2UtYTM4YS02OTU4LWI4ZzYtNmQxNGdhZDU4NmUxXCJ9IiwiaWF0IjoxNzU5ODUyMDQ3LCJleHAiOjE3NTk4NTI2NDd9.xyz789_another_token_here" + }, + "field:anrede": "Herr", + "field:long_answer_3524": "Wir planen unseren Weihnachtsurlaub mit drei Kindern. Brauchen Kinderbetten und Nähe zum Spielplatz.", + "formId": "g206228d-ch05-6g6f-d7h7-296330eef5d3" + } +} diff --git a/tests/test_data/test_form4.json b/tests/test_data/test_form4.json index 9d233e3..2c9e935 100644 --- a/tests/test_data/test_form4.json +++ b/tests/test_data/test_form4.json @@ -1,241 +1,243 @@ -{"data": { - "formName": "Business Travel Request", - "submissions": [ +{ + "data": { + "formName": "Business Travel Request", + "submissions": [ + { + "label": "Angebot auswählen", + "value": "Zimmer: Business Suite" + }, + { + "label": "Anreisedatum", + "value": "2025-11-08" + }, + { + "label": "Abreisedatum", + "value": "2025-11-10" + }, + { + "label": "Anzahl Erwachsene", + "value": "1" + }, + { + "label": "Anzahl Kinder", + "value": "0" + }, + { + "label": "Anrede", + "value": "Frau" + }, + { + "label": "Vorname", + "value": "Sarah" + }, + { + "label": "Nachname", + "value": "Johnson" + }, + { + "label": "Email", + "value": "sarah.johnson@businesscorp.com" + }, + { + "label": "Phone", + "value": "+1 555 987 6543" + }, + { + "label": "Message", + "value": "Business trip for conference. Need WiFi and workspace. Will arrive late on Monday." + }, + { + "label": "Einwilligung Marketing", + "value": "" + }, + { + "label": "utm_Source", + "value": "direct" + }, + { + "label": "utm_Medium", + "value": "none" + }, + { + "label": "utm_Campaign", + "value": "" + }, + { + "label": "utm_Term", + "value": "" + }, + { + "label": "utm_Content", + "value": "" + }, + { + "label": "utm_term_id", + "value": "" + }, + { + "label": "utm_content_id", + "value": "" + }, + { + "label": "gad_source", + "value": "" + }, + { + "label": "gad_campaignid", + "value": "" + }, + { + "label": "gbraid", + "value": "" + }, + { + "label": "gclid", + "value": "" + }, + { + "label": "fbclid", + "value": "" + }, + { + "label": "hotelid", + "value": "135" + }, + { + "label": "hotelname", + "value": "Business Hotel Alpine" + } + ], + "field:date_picker_7e65": "2025-11-10", + "field:number_7cf5": "1", + "field:utm_source": "direct", + "submissionTime": "2025-10-06T09:15:45.001Z", + "field:gad_source": "", + "field:form_field_5a7b": true, + "field:gad_campaignid": "", + "field:utm_medium": "none", + "field:utm_term_id": "", + "context": { + "metaSiteId": "4hde054f-b49b-7a69-c9h7-7e25hbe697f2", + "activationId": "2g1c2f13-3668-7hg5-ca9g-cb8d39h942e3" + }, + "field:email_5139": "sarah.johnson@businesscorp.com", + "field:phone_4c77": "+1 555 987 6543", + "_context": { + "activation": { + "id": "2g1c2f13-3668-7hg5-ca9g-cb8d39h942e3" + }, + "configuration": { + "id": "d2a9241f-2db9-728g-eh4h-9a9g2411hhd0" + }, + "app": { + "id": "558gg245-ah1c-7a61-b9bb-7e1f9288ccede" + }, + "action": { + "id": "485ge7ga-8596-73f7-fh5e-4f146a9651ea" + }, + "trigger": { + "key": "wix_form_app-form_submitted" + } + }, + "field:gclid": "", + "formFieldMask": [ + "field:", + "field:", + "field:angebot_auswaehlen", + "field:date_picker_a7c8", + "field:date_picker_7e65", + "field:", + "field:number_7cf5", + "field:anzahl_kinder", + "field:alter_kind_3", + "field:alter_kind_25", + "field:alter_kind_4", + "field:alter_kind_5", + "field:alter_kind_6", + "field:alter_kind_7", + "field:alter_kind_8", + "field:alter_kind_9", + "field:alter_kind_10", + "field:alter_kind_11", + "field:", + "field:anrede", + "field:first_name_abae", + "field:last_name_d97c", + "field:email_5139", + "field:phone_4c77", + "field:long_answer_3524", + "field:form_field_5a7b", + "field:", + "field:utm_source", + "field:utm_medium", + "field:utm_campaign", + "field:utm_term", + "field:utm_content", + "field:utm_term_id", + "field:utm_content_id", + "field:gad_source", + "field:gad_campaignid", + "field:gbraid", + "field:gclid", + "field:fbclid", + "field:hotelid", + "field:hotelname", + "field:", + "metaSiteId" + ], + "contact": { + "name": { + "first": "Sarah", + "last": "Johnson" + }, + "email": "sarah.johnson@businesscorp.com", + "locale": "en-us", + "phones": [ { - "label": "Angebot auswählen", - "value": "Zimmer: Business Suite" - }, - { - "label": "Anreisedatum", - "value": "2025-11-08" - }, - { - "label": "Abreisedatum", - "value": "2025-11-10" - }, - { - "label": "Anzahl Erwachsene", - "value": "1" - }, - { - "label": "Anzahl Kinder", - "value": "0" - }, - { - "label": "Anrede", - "value": "Frau" - }, - { - "label": "Vorname", - "value": "Sarah" - }, - { - "label": "Nachname", - "value": "Johnson" - }, - { - "label": "Email", - "value": "sarah.johnson@businesscorp.com" - }, - { - "label": "Phone", - "value": "+1 555 987 6543" - }, - { - "label": "Message", - "value": "Business trip for conference. Need WiFi and workspace. Will arrive late on Monday." - }, - { - "label": "Einwilligung Marketing", - "value": "" - }, - { - "label": "utm_Source", - "value": "direct" - }, - { - "label": "utm_Medium", - "value": "none" - }, - { - "label": "utm_Campaign", - "value": "" - }, - { - "label": "utm_Term", - "value": "" - }, - { - "label": "utm_Content", - "value": "" - }, - { - "label": "utm_term_id", - "value": "" - }, - { - "label": "utm_content_id", - "value": "" - }, - { - "label": "gad_source", - "value": "" - }, - { - "label": "gad_campaignid", - "value": "" - }, - { - "label": "gbraid", - "value": "" - }, - { - "label": "gclid", - "value": "" - }, - { - "label": "fbclid", - "value": "" - }, - { - "label": "hotelid", - "value": "135" - }, - { - "label": "hotelname", - "value": "Business Hotel Alpine" + "tag": "UNTAGGED", + "formattedPhone": "+1 555 987 6543", + "id": "863d6eh7-9geg-7944-bc96-d83gc138513g", + "countryCode": "US", + "e164Phone": "+15559876543", + "primary": true, + "phone": "555 9876543" } ], - "field:date_picker_7e65": "2025-11-10", - "field:number_7cf5": "1", - "field:utm_source": "direct", - "submissionTime": "2025-10-06T09:15:45.001Z", - "field:gad_source": "", - "field:form_field_5a7b": "", - "field:gad_campaignid": "", - "field:utm_medium": "none", - "field:utm_term_id": "", - "context": { - "metaSiteId": "4hde054f-b49b-7a69-c9h7-7e25hbe697f2", - "activationId": "2g1c2f13-3668-7hg5-ca9g-cb8d39h942e3" - }, - "field:email_5139": "sarah.johnson@businesscorp.com", - "field:phone_4c77": "+1 555 987 6543", - "_context": { - "activation": { - "id": "2g1c2f13-3668-7hg5-ca9g-cb8d39h942e3" - }, - "configuration": { - "id": "d2a9241f-2db9-728g-eh4h-9a9g2411hhd0" - }, - "app": { - "id": "558gg245-ah1c-7a61-b9bb-7e1f9288ccede" - }, - "action": { - "id": "485ge7ga-8596-73f7-fh5e-4f146a9651ea" - }, - "trigger": { - "key": "wix_form_app-form_submitted" - } - }, - "field:gclid": "", - "formFieldMask": [ - "field:", - "field:", - "field:angebot_auswaehlen", - "field:date_picker_a7c8", - "field:date_picker_7e65", - "field:", - "field:number_7cf5", - "field:anzahl_kinder", - "field:alter_kind_3", - "field:alter_kind_25", - "field:alter_kind_4", - "field:alter_kind_5", - "field:alter_kind_6", - "field:alter_kind_7", - "field:alter_kind_8", - "field:alter_kind_9", - "field:alter_kind_10", - "field:alter_kind_11", - "field:", - "field:anrede", - "field:first_name_abae", - "field:last_name_d97c", - "field:email_5139", - "field:phone_4c77", - "field:long_answer_3524", - "field:form_field_5a7b", - "field:", - "field:utm_source", - "field:utm_medium", - "field:utm_campaign", - "field:utm_term", - "field:utm_content", - "field:utm_term_id", - "field:utm_content_id", - "field:gad_source", - "field:gad_campaignid", - "field:gbraid", - "field:gclid", - "field:fbclid", - "field:hotelid", - "field:hotelname", - "field:", - "metaSiteId" - ], - "contact": { - "name": { - "first": "Sarah", - "last": "Johnson" - }, - "email": "sarah.johnson@businesscorp.com", - "locale": "en-us", - "phones": [ - { - "tag": "UNTAGGED", - "formattedPhone": "+1 555 987 6543", - "id": "863d6eh7-9geg-7944-bc96-d83gc138513g", - "countryCode": "US", - "e164Phone": "+15559876543", - "primary": true, - "phone": "555 9876543" - } - ], - "contactId": "46982gdb-7368-7ah2-d99e-9fh794dg623h", - "emails": [ - { - "id": "h4g5491h-fd6f-7b77-b2c6-25h4e3dh03h6", - "tag": "UNTAGGED", - "email": "sarah.johnson@businesscorp.com", - "primary": true - } - ], - "updatedDate": "2025-10-06T09:15:46.675Z", - "phone": "+15559876543", - "createdDate": "2025-10-06T09:15:46.675Z" - }, - "submissionId": "b9h57agf-ch8d-7hea-baeb-9aaeth97978dg", - "field:anzahl_kinder": "0", - "field:first_name_abae": "Sarah", - "field:utm_content_id": "", - "field:utm_campaign": "", - "field:utm_term": "", "contactId": "46982gdb-7368-7ah2-d99e-9fh794dg623h", - "field:date_picker_a7c8": "2025-11-08", - "field:hotelname": "Business Hotel Alpine", - "field:angebot_auswaehlen": "Zimmer: Business Suite", - "field:utm_content": "", - "field:last_name_d97c": "Johnson", - "field:hotelid": "135", - "submissionsLink": "https://manage.wix.app/forms/submissions/4hde054f-b49b-7a69-c9h7-7e25hbe697f2/h317339e-di16-7h7g-e8i8-3a7441ffg6e4?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F4hde054f-b49b-7a69-c9h7-7e25hbe697f2%2Fwix-forms%2Fform%2Fh317339e-di16-7h7g-e8i8-3a7441ffg6e4%2Fsubmissions&s=true", - "field:gbraid": "", - "field:fbclid": "", - "submissionPdf": { - "fileName": "b9h57agf-ch8d-7hea-baeb-9aaeth97978dg.pdf", - "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/b9h57agf-ch8d-7hea-baeb-9aaeth97978dg/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiNGhkZTA1NGYtYjQ5Yi03YTY5LWM5aDctN2UyNWhiZTY5N2YyXCJ9IiwiaWF0IjoxNzU5ODI5MzQ2LCJleHAiOjE3NTk4Mjk5NDZ9.business_token_987654" - }, - "field:anrede": "Frau", - "field:long_answer_3524": "Business trip for conference. Need WiFi and workspace. Will arrive late on Monday.", - "formId": "h317339e-di16-7h7g-e8i8-3a7441ffg6e4" - }} \ No newline at end of file + "emails": [ + { + "id": "h4g5491h-fd6f-7b77-b2c6-25h4e3dh03h6", + "tag": "UNTAGGED", + "email": "sarah.johnson@businesscorp.com", + "primary": true + } + ], + "updatedDate": "2025-10-06T09:15:46.675Z", + "phone": "+15559876543", + "createdDate": "2025-10-06T09:15:46.675Z" + }, + "submissionId": "b9h57agf-ch8d-7hea-baeb-9aaeth97978dg", + "field:anzahl_kinder": "0", + "field:first_name_abae": "Sarah", + "field:utm_content_id": "", + "field:utm_campaign": "", + "field:utm_term": "", + "contactId": "46982gdb-7368-7ah2-d99e-9fh794dg623h", + "field:date_picker_a7c8": "2025-11-08", + "field:hotelname": "Business Hotel Alpine", + "field:angebot_auswaehlen": "Zimmer: Business Suite", + "field:utm_content": "", + "field:last_name_d97c": "Johnson", + "field:hotelid": "135", + "submissionsLink": "https://manage.wix.app/forms/submissions/4hde054f-b49b-7a69-c9h7-7e25hbe697f2/h317339e-di16-7h7g-e8i8-3a7441ffg6e4?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F4hde054f-b49b-7a69-c9h7-7e25hbe697f2%2Fwix-forms%2Fform%2Fh317339e-di16-7h7g-e8i8-3a7441ffg6e4%2Fsubmissions&s=true", + "field:gbraid": "", + "field:fbclid": "", + "submissionPdf": { + "fileName": "b9h57agf-ch8d-7hea-baeb-9aaeth97978dg.pdf", + "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/b9h57agf-ch8d-7hea-baeb-9aaeth97978dg/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiNGhkZTA1NGYtYjQ5Yi03YTY5LWM5aDctN2UyNWhiZTY5N2YyXCJ9IiwiaWF0IjoxNzU5ODI5MzQ2LCJleHAiOjE3NTk4Mjk5NDZ9.business_token_987654" + }, + "field:anrede": "Frau", + "field:long_answer_3524": "Business trip for conference. Need WiFi and workspace. Will arrive late on Monday.", + "formId": "h317339e-di16-7h7g-e8i8-3a7441ffg6e4" + } +} diff --git a/tests/test_data/test_form5.json b/tests/test_data/test_form5.json new file mode 100644 index 0000000..93dff36 --- /dev/null +++ b/tests/test_data/test_form5.json @@ -0,0 +1,275 @@ +{ + "data": { + "formName": "Contact us", + "submissions": [ + { + "label": "Angebot auswählen", + "value": "Zimmer: Doppelzimmer" + }, + { + "label": "Anreisedatum", + "value": "2026-06-25" + }, + { + "label": "Abreisedatum", + "value": "2026-06-28" + }, + { + "label": "Anzahl Erwachsene", + "value": "7" + }, + { + "label": "Anzahl Kinder", + "value": "3" + }, + { + "label": "Alter Kind 1", + "value": "4" + }, + { + "label": "Alter Kind 2", + "value": "3" + }, + { + "label": "Alter Kind 3", + "value": "1" + }, + { + "label": "Alter Kind 4", + "value": "0" + }, + { + "label": "Alter Kind 5", + "value": "0" + }, + { + "label": "Alter Kind 6", + "value": "0" + }, + { + "label": "Alter Kind 7", + "value": "0" + }, + { + "label": "Anrede", + "value": "Frau" + }, + { + "label": "Vorname", + "value": "Petra" + }, + { + "label": "Nachname", + "value": "Pohl" + }, + { + "label": "Email", + "value": "petrapohl79@yahoo.com" + }, + { + "label": "Phone", + "value": "+49 176 72219046" + }, + { + "label": "Message", + "value": "Wir hatten als Familie vor einigen Jahren ein Wochenende bei Ihnen verbracht " + }, + { + "label": "utm_Source", + "value": "" + }, + { + "label": "utm_Medium", + "value": "" + }, + { + "label": "utm_Campaign", + "value": "" + }, + { + "label": "utm_Term", + "value": "" + }, + { + "label": "utm_Content", + "value": "" + }, + { + "label": "utm_term_id", + "value": "" + }, + { + "label": "utm_content_id", + "value": "" + }, + { + "label": "gad_source", + "value": "1" + }, + { + "label": "gad_campaignid", + "value": "183901432" + }, + { + "label": "gbraid", + "value": "0AAAAADxR52Ad0oCzeogeTrupgGeMwD7Yp" + }, + { + "label": "gclid", + "value": "EAIaIQobChMIpNik0vXskAMVOoCDBx0cSQ1GEAAYASAAEgLog_D_BwE" + }, + { + "label": "fbclid", + "value": "" + }, + { + "label": "hotelid", + "value": "39054_001" + }, + { + "label": "hotelname", + "value": "Bemelmans Post" + } + ], + "field:date_picker_7e65": "2026-06-28", + "field:alter_kind_7": 0, + "field:number_7cf5": 7, + "field:utm_source": "", + "submissionTime": "2025-11-12T15:32:23.208Z", + "field:alter_kind_3": 4, + "field:gad_source": "1", + "field:gad_campaignid": "183901432", + "field:utm_medium": "", + "field:utm_term_id": "", + "context": { + "metaSiteId": "1dea821c-8168-4736-96e4-4b92e8b364cf", + "activationId": "84dc33f6-ff90-4a2a-b77b-5f32fe9e3fc2" + }, + "field:email_5139": "petrapohl79@yahoo.com", + "field:phone_4c77": "+4917672219046", + "_context": { + "activation": { + "id": "84dc33f6-ff90-4a2a-b77b-5f32fe9e3fc2" + }, + "configuration": { + "id": "a976f18c-fa86-495d-be1e-676df188eeae" + }, + "app": { + "id": "225dd912-7dea-4738-8688-4b8c6955ffc2" + }, + "action": { + "id": "152db4d7-5263-40c4-be2b-1c81476318b7" + }, + "trigger": { + "key": "wix_form_app-form_submitted" + } + }, + "field:gclid": "EAIaIQobChMIpNik0vXskAMVOoCDBx0cSQ1GEAAYASAAEgLog_D_BwE", + "field:alter_kind_8": 0, + "formFieldMask": [ + "field:", + "field:", + "field:angebot_auswaehlen", + "field:date_picker_a7c8", + "field:date_picker_7e65", + "field:", + "field:number_7cf5", + "field:anzahl_kinder", + "field:alter_kind_3", + "field:alter_kind_25", + "field:alter_kind_4", + "field:alter_kind_5", + "field:alter_kind_6", + "field:alter_kind_7", + "field:alter_kind_8", + "field:alter_kind_9", + "field:alter_kind_10", + "field:alter_kind_11", + "field:", + "field:anrede", + "field:first_name_abae", + "field:last_name_d97c", + "field:email_5139", + "field:phone_4c77", + "field:long_answer_3524", + "field:form_field_5a7b", + "field:", + "field:utm_source", + "field:utm_medium", + "field:utm_campaign", + "field:utm_term", + "field:utm_content", + "field:utm_term_id", + "field:utm_content_id", + "field:gad_source", + "field:gad_campaignid", + "field:gbraid", + "field:gclid", + "field:fbclid", + "field:hotelid", + "field:hotelname", + "field:roomtypecode", + "field:roomclassificationcode", + "field:", + "metaSiteId" + ], + "field:alter_kind_4": 1, + "contact": { + "name": { + "first": "Petra", + "last": "Pohl" + }, + "email": "petrapohl79@yahoo.com", + "locale": "de-de", + "phones": [ + { + "tag": "UNTAGGED", + "formattedPhone": "+49 176 72219046", + "id": "332e1d29-9ece-4e87-85bd-f39654be00b8", + "countryCode": "DE", + "e164Phone": "+4917672219046", + "primary": true, + "phone": "176 72219046" + } + ], + "contactId": "5cd8d5a4-8705-49f5-b1be-c61dab5355d1", + "emails": [ + { + "id": "4dbbbe7c-2892-47e8-b7e2-982c9f44407d", + "tag": "UNTAGGED", + "email": "petrapohl79@yahoo.com", + "primary": true + } + ], + "updatedDate": "2025-11-12T15:32:24.771Z", + "phone": "+4917672219046", + "createdDate": "2025-11-12T15:32:24.771Z" + }, + "submissionId": "ae8837ee-bb2d-4bad-a065-7e366dde7e6b", + "field:anzahl_kinder": 3, + "field:alter_kind_25": 3, + "field:alter_kind_5": 0, + "field:first_name_abae": "Petra", + "field:utm_content_id": "", + "field:utm_campaign": "", + "field:utm_term": "", + "contactId": "5cd8d5a4-8705-49f5-b1be-c61dab5355d1", + "field:alter_kind_6": 0, + "field:date_picker_a7c8": "2026-06-25", + "field:hotelname": "Bemelmans Post", + "field:angebot_auswaehlen": "Zimmer: Doppelzimmer", + "field:utm_content": "", + "field:last_name_d97c": "Pohl", + "field:hotelid": "39054_001", + "submissionsLink": "https://manage.wix.app/forms/submissions/1dea821c-8168-4736-96e4-4b92e8b364cf/e084006b-ae83-4e4d-b2f5-074118cdb3b1?d=https%3A%2F%2Fmanage.wix.com%2Fdashboard%2F1dea821c-8168-4736-96e4-4b92e8b364cf%2Fwix-forms%2Fform%2Fe084006b-ae83-4e4d-b2f5-074118cdb3b1%2Fsubmissions&s=true", + "field:gbraid": "0AAAAADxR52Ad0oCzeogeTrupgGeMwD7Yp", + "field:fbclid": "", + "submissionPdf": { + "fileName": "ae8837ee-bb2d-4bad-a065-7e366dde7e6b.pdf", + "downloadUrl": "https://manage.wix.com/_api/form-submission-service/v4/submissions/ae8837ee-bb2d-4bad-a065-7e366dde7e6b/download?accessToken=JWS.eyJraWQiOiJWLVNuLWhwZSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wibWV0YVNpdGVJZFwiOlwiMWRlYTgyMWMtODE2OC00NzM2LTk2ZTQtNGI5MmU4YjM2NGNmXCJ9IiwiaWF0IjoxNzYyOTYxNTQ1LCJleHAiOjE3NjI5NjIxNDV9.ThbV0VtGcaDfYzuQKsN24uWyUeCtwZq3Z3Z4flTqEBg" + }, + "field:anrede": "Frau", + "field:long_answer_3524": "Wir hatten als Familie vor einigen Jahren ein Wochenende bei Ihnen verbracht ", + "formId": "e084006b-ae83-4e4d-b2f5-074118cdb3b1" + } +}