Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(destination): stringify the object and array for Clevertap #1554

Merged
merged 11 commits into from
Nov 9, 2022
219 changes: 82 additions & 137 deletions __tests__/data/clevertap_output.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[
{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://api.clevertap.com/1/upload",
"headers": {
"X-CleverTap-Account-Id": "476550467",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"Content-Type": "application/json"
},
"params": {},
"body": {
"XML": {},
"JSON_ARRAY": {},
"FORM": {},
"JSON": {
"d": [
{
"identity": "anon_id",
"type": "profile",
"profileData": {
"Email": "[email protected]",
Expand All @@ -20,38 +26,23 @@
"Married": true,
"Customer Type": "Prime",
"graduate": true,
"msgSms": true,
"msg_push": true,
"msgSms": true,
"msgemail": true,
"msgwhatsapp": false,
"custom_tags": ["Test_User", "Interested_User", "DIY_Hobby"],
"custom_mappings": {
"Office": "Trastkiv",
"Country": "Russia"
},
"address": {
"city": "kolkata",
"country": "India",
"postalCode": 789223,
"state": "WB",
"street": ""
}
}
"custom_tags": "[\"Test_User\",\"Interested_User\",\"DIY_Hobby\"]",
"custom_mappings": "{\"Office\":\"Trastkiv\",\"Country\":\"Russia\"}",
"address": "{\"city\":\"kolkata\",\"country\":\"India\",\"postalCode\":789223,\"state\":\"WB\",\"street\":\"\"}"
},
"identity": "anon_id"
}
]
}
},
"type": "REST",
"files": {},
"method": "POST",
"params": {},
"headers": {
"X-CleverTap-Account-Id": "476550467",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"Content-Type": "application/json"
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"version": "1",
"endpoint": "https://api.clevertap.com/1/upload"
"files": {}
},
{
"body": {
Expand Down Expand Up @@ -152,77 +143,64 @@
"error": "Message type not supported"
},
{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://api.clevertap.com/1/upload",
"headers": {
"X-CleverTap-Account-Id": "476550467",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"Content-Type": "application/json"
},
"params": {},
"body": {
"XML": {},
"JSON_ARRAY": {},
"FORM": {},
"JSON": {
"d": [
{
"type": "event",
"evtName": "Charged",
"evtData": {
"Charged ID": "12345",
"Amount": 15,
"Items": "[{\"sku\":\"G-32\",\"url\":\"https://www.website.com/product/path\",\"name\":\"Monopoly\",\"price\":14,\"category\":\"Games\",\"quantity\":1,\"image_url\":\"https://www.website.com/product/path.jpg\",\"product_id\":\"123\"},{\"sku\":\"F-32\",\"name\":\"UNO\",\"price\":3.45,\"category\":\"Games\",\"quantity\":2,\"product_id\":\"345\"}]",
"tax": 1,
"Items": [
{
"sku": "G-32",
"url": "https://www.website.com/product/path",
"name": "Monopoly",
"price": 14,
"category": "Games",
"quantity": 1,
"image_url": "https://www.website.com/product/path.jpg",
"product_id": "123"
},
{
"sku": "F-32",
"name": "UNO",
"price": 3.45,
"category": "Games",
"quantity": 2,
"product_id": "345"
}
],
"total": 20,
"Amount": 15,
"coupon": "ImagePro",
"currency": "USD",
"discount": 1.5,
"order_id": "1234",
"shipping": 22,
"Charged ID": "12345",
"affiliation": "Apple Store"
},
"ts": 1615377562,
"evtName": "Charged",
"type": "event",
"identity": "riverjohn"
}
]
}
},
"type": "REST",
"files": {},
"method": "POST",
"params": {},
"headers": {
"Content-Type": "application/json",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"X-CleverTap-Account-Id": "476550467"
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"version": "1",
"endpoint": "https://api.clevertap.com/1/upload"
"files": {}
},
{
"error": "userId, not present cannot track anonymous user"
},
{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://api.clevertap.com/1/upload",
"headers": {
"X-CleverTap-Account-Id": "476550467",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"Content-Type": "application/json"
},
"params": {},
"body": {
"XML": {},
"JSON_ARRAY": {},
"FORM": {},
"JSON": {
"d": [
{
"identity": "anon_id",
"type": "profile",
"profileData": {
"Email": "[email protected]",
Expand All @@ -235,48 +213,39 @@
"Married": true,
"Customer Type": "Prime",
"graduate": true,
"msgSms": true,
"msg_push": true,
"msgSms": true,
"msgemail": true,
"msgwhatsapp": false,
"custom_tags": ["Test_User", "Interested_User", "DIY_Hobby"],
"custom_mappings": {
"Office": "Trastkiv",
"Country": "Russia"
},
"address": {
"city": "kolkata",
"country": "India",
"postalCode": 789223,
"state": "WB",
"street": ""
}
}
"custom_tags": "[\"Test_User\",\"Interested_User\",\"DIY_Hobby\"]",
"custom_mappings": "{\"Office\":\"Trastkiv\",\"Country\":\"Russia\"}",
"address": "{\"city\":\"kolkata\",\"country\":\"India\",\"postalCode\":789223,\"state\":\"WB\",\"street\":\"\"}"
},
"identity": "anon_id"
}
]
}
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"files": {}
},
{
"version": "1",
"type": "REST",
"files": {},
"method": "POST",
"params": {},
"endpoint": "https://api.clevertap.com/1/upload",
"headers": {
"X-CleverTap-Account-Id": "476550467",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"Content-Type": "application/json"
},
"version": "1",
"endpoint": "https://api.clevertap.com/1/upload"
},
{
"params": {},
"body": {
"XML": {},
"JSON_ARRAY": {},
"FORM": {},
"JSON": {
"d": [
{
"identity": "anon_id",
"type": "profile",
"profileData": {
"Email": "[email protected]",
Expand All @@ -288,38 +257,23 @@
"Married": true,
"Customer Type": "Prime",
"graduate": true,
"msgSms": true,
"msg_push": true,
"msgSms": true,
"msgemail": true,
"msgwhatsapp": false,
"custom_tags": ["Test_User", "Interested_User", "DIY_Hobby"],
"custom_mappings": {
"Office": "Trastkiv",
"Country": "Russia"
},
"address": {
"city": "kolkata",
"country": "India",
"postalCode": 789223,
"state": "WB",
"street": ""
}
}
"custom_tags": "[\"Test_User\",\"Interested_User\",\"DIY_Hobby\"]",
"custom_mappings": "{\"Office\":\"Trastkiv\",\"Country\":\"Russia\"}",
"address": "{\"city\":\"kolkata\",\"country\":\"India\",\"postalCode\":789223,\"state\":\"WB\",\"street\":\"\"}"
},
"identity": "anon_id"
}
]
}
},
"type": "REST",
"files": {},
"method": "POST",
"params": {},
"headers": {
"X-CleverTap-Account-Id": "476550467",
"X-CleverTap-Passcode": "fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1",
"Content-Type": "application/json"
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"version": "1",
"endpoint": "https://api.clevertap.com/1/upload"
"files": {}
},
[
{
Expand Down Expand Up @@ -509,26 +463,17 @@
"msgSms": true,
"msgemail": true,
"msgwhatsapp": false,
"custom_tags": ["Test_User", "Interested_User", "DIY_Hobby"],
"custom_mappings": {
"Office": "Trastkiv",
"Country": "Russia"
},
"address": {
"city": "kolkata",
"country": "India",
"postalCode": 789223,
"state": "WB",
"street": ""
}
"custom_tags": "[\"Test_User\",\"Interested_User\",\"DIY_Hobby\"]",
"custom_mappings": "{\"Office\":\"Trastkiv\",\"Country\":\"Russia\"}",
"address": "{\"city\":\"kolkata\",\"country\":\"India\",\"postalCode\":789223,\"state\":\"WB\",\"street\":\"\"}"
},
"ts": 1615377562,
"identity": "anon_id"
}
]
},
"XML": {},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"files": {}
Expand Down
15 changes: 3 additions & 12 deletions __tests__/data/clevertap_router_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,9 @@
"msgSms": true,
"msgemail": true,
"msgwhatsapp": false,
"custom_tags": ["Test_User", "Interested_User", "DIY_Hobby"],
"custom_mappings": {
"Office": "Trastkiv",
"Country": "Russia"
},
"address": {
"city": "kolkata",
"country": "India",
"postalCode": 789223,
"state": "WB",
"street": ""
}
"custom_tags": "[\"Test_User\",\"Interested_User\",\"DIY_Hobby\"]",
"custom_mappings": "{\"Office\":\"Trastkiv\",\"Country\":\"Russia\"}",
"address": "{\"city\":\"kolkata\",\"country\":\"India\",\"postalCode\":789223,\"state\":\"WB\",\"street\":\"\"}"
}
}
]
Expand Down
Loading