Skip to content

Commit

Permalink
fix: products array mapping and rename impact_radius to impact (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ab authored Jan 19, 2023
1 parent 6c01642 commit f812f0d
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 3 deletions.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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

0 comments on commit f812f0d

Please sign in to comment.