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

fix: products array mapping and rename impact_radius to impact #1797

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"destKey": "EventDate",
"sourceKeys": "timestamp",
"sourceFromGenericMap": true,
"required": false
"required": true
},
{
"destKey": "CurrencyCode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const getProductsMapping = (productsMapping, itemName) => {
productsMapping.forEach((mapping) => {
prop = mapping.to === itemName ? mapping.from : itemMapping[itemName];
});
} else {
prop = itemMapping[itemName];
}
return prop;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,124 @@
}
]
},
{
"description": "Track Call with products array without any custom products mapping",
"input": {
"message": {
"event": "Product Purchased",
"type": "track",
"sentAt": "2021-01-03T17:02:53.195Z",
"userId": "Ujjwalab",
"channel": "web",
"properties": {
"orderId": "9217374917471",
"coupon": "10OFF-ROCKET",
"clickId": "wEWU47yhtzBnU-CTug3:7Wv4UkAzMbzkZ2lTz80",
"products": [
{
"brand": "zara",
"category": "wearables",
"name": "Monopoly",
"price": 332,
"quantity": 1,
"sku": "G-32"
}
]
},
"context": {
"os": {
"name": "",
"version": ""
},
"app": {
"name": "RudderLabs JavaScript SDK",
"build": "1.0.0",
"version": "1.1.11",
"namespace": "com.rudderlabs.javascript"
},
"locale": "en-US",
"screen": {
"density": 2
},
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "1.1.11"
},
"campaign": {},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0"
},
"rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f",
"messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff",
"anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35",
"originalTimestamp": "NOW"
},
"destination": {
"Config": {
"accountSID": "dfsgertrtff3erfc34rfwf",
"apiKey": "fghsdfgegvcergfvfdfsag",
"campaignId": "23224",
"impactAppId": "2323",
"eventTypeId": "56446",
"enableEmailHashing": true,
"rudderToImpactProperty": [
{
"from": "properties.profit",
"to": "Money1"
}
],
"productsMapping": "",
"enableIdentifyEvents": false,
"enablePageEvents": false,
"enableScreenEvents": false,
"actionEventNames": [{ "eventName": "Product Purchased" }],
"installEventNames": [{ "eventName": "App Installed" }]
}
}
},
"output": [
{
"body": {
"XML": {},
"FORM": {
"AppVer": "1.1.11",
"AppName": "RudderLabs JavaScript SDK",
"ClickId": "wEWU47yhtzBnU-CTug3:7Wv4UkAzMbzkZ2lTz80",
"OrderId": "9217374917471",
"ItemSku1": "G-32",
"EventDate": "NOW",
"ItemName1": "Monopoly",
"UserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
"AppPackage": "1.0.0",
"CampaignId": "23224",
"CustomerId": "Ujjwalab",
"ItemBrand1": "zara",
"ItemPrice1": 332,
"EventTypeId": "56446",
"ImpactAppId": "2323",
"DeviceLocale": "en-US",
"EventTypeCode": "Product Purchased",
"ItemQuantity1": 1,
"ItemCategory1": "wearables",

"OrderPromoCode": "10OFF-ROCKET",
"CustomProfileId": "97c46c81-3140-456d-b2a9-690d70aaca35"
},
"JSON": {},
"JSON_ARRAY": {}
},
"type": "REST",
"files": {},
"method": "POST",
"params": {},
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic ZGZzZ2VydHJ0ZmYzZXJmYzM0cmZ3ZjpmZ2hzZGZnZWd2Y2VyZ2Z2ZmRmc2Fn"
},
"version": "1",
"endpoint": "https://api.impact.com/Advertisers/dfsgertrtff3erfc34rfwf/Conversions"
}
]
},
{
"description": "Track Call with products array to test conversion endpoint with a custom products mapping",
"input": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fs = require("fs");
const path = require("path");

const integration = "impact_radius";
const name = "IMPACT_RADIUS";
const integration = "impact";
const name = "IMPACT";
const version = "v0";

const transformer = require(`../../src/${version}/destinations/${integration}/transform`);
Expand Down