diff --git a/src/v0/destinations/impact_radius/config.js b/src/v0/destinations/impact/config.js similarity index 100% rename from src/v0/destinations/impact_radius/config.js rename to src/v0/destinations/impact/config.js diff --git a/src/v0/destinations/impact_radius/data/ImpactConversionConfig.json b/src/v0/destinations/impact/data/ImpactConversionConfig.json similarity index 99% rename from src/v0/destinations/impact_radius/data/ImpactConversionConfig.json rename to src/v0/destinations/impact/data/ImpactConversionConfig.json index 167cf0483e5..7ae0cc72eb3 100644 --- a/src/v0/destinations/impact_radius/data/ImpactConversionConfig.json +++ b/src/v0/destinations/impact/data/ImpactConversionConfig.json @@ -9,7 +9,7 @@ "destKey": "EventDate", "sourceKeys": "timestamp", "sourceFromGenericMap": true, - "required": false + "required": true }, { "destKey": "CurrencyCode", diff --git a/src/v0/destinations/impact_radius/data/ImpactPageLoadConfig.json b/src/v0/destinations/impact/data/ImpactPageLoadConfig.json similarity index 100% rename from src/v0/destinations/impact_radius/data/ImpactPageLoadConfig.json rename to src/v0/destinations/impact/data/ImpactPageLoadConfig.json diff --git a/src/v0/destinations/impact_radius/transform.js b/src/v0/destinations/impact/transform.js similarity index 100% rename from src/v0/destinations/impact_radius/transform.js rename to src/v0/destinations/impact/transform.js diff --git a/src/v0/destinations/impact_radius/util.js b/src/v0/destinations/impact/util.js similarity index 99% rename from src/v0/destinations/impact_radius/util.js rename to src/v0/destinations/impact/util.js index 27cee1639c5..b8c6e92e76f 100644 --- a/src/v0/destinations/impact_radius/util.js +++ b/src/v0/destinations/impact/util.js @@ -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; }; diff --git a/test/__tests__/data/impact_radius.json b/test/__tests__/data/impact.json similarity index 93% rename from test/__tests__/data/impact_radius.json rename to test/__tests__/data/impact.json index 29003eca588..729d1a36cf4 100644 --- a/test/__tests__/data/impact_radius.json +++ b/test/__tests__/data/impact.json @@ -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": { diff --git a/test/__tests__/data/impact_radius_router.json b/test/__tests__/data/impact_router.json similarity index 100% rename from test/__tests__/data/impact_radius_router.json rename to test/__tests__/data/impact_router.json diff --git a/test/__tests__/impact_radius.test.js b/test/__tests__/impact.test.js similarity index 94% rename from test/__tests__/impact_radius.test.js rename to test/__tests__/impact.test.js index ad2dfd6f8ee..8a741840deb 100644 --- a/test/__tests__/impact_radius.test.js +++ b/test/__tests__/impact.test.js @@ -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`);