From 2ebff956ff2aa74b008a8de832a31d8774d2d47e Mon Sep 17 00:00:00 2001 From: Anant Jain <62471433+anantjain45823@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:50:00 +0530 Subject: [PATCH] fix: rakuten: sync property mapping sourcekeys to rudderstack standard spec (#3129) * fix: rakuten: sync property mapping sourcekeys to rudderstack standard spec * chore: comments addressed --- .../rakuten/data/propertiesMapping.json | 76 ++++++++++++++----- .../processor/transformationFailure.ts | 6 +- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/cdk/v2/destinations/rakuten/data/propertiesMapping.json b/src/cdk/v2/destinations/rakuten/data/propertiesMapping.json index e04765faed..db5d36fc4d 100644 --- a/src/cdk/v2/destinations/rakuten/data/propertiesMapping.json +++ b/src/cdk/v2/destinations/rakuten/data/propertiesMapping.json @@ -1,25 +1,34 @@ [ { - "sourceKeys": "properties.orderId", + "sourceKeys": ["properties.order_id", "properties.orderId"], "required": true, "destKey": "ord" }, { - "sourceKeys": ["properties.tr", "properties.ranSiteID"], + "sourceKeys": ["properties.tr", "properties.ran_site_id", "properties.ranSiteID"], "required": true, "destKey": "tr" }, { - "sourceKeys": ["properties.land", "properties.landTime"], + "sourceKeys": ["properties.land", "properties.land_time", "properties.landTime"], "required": true, "destKey": "land" }, { - "sourceKeys": ["properties.date", "properties.orderCompletedTime"], + "sourceKeys": [ + "properties.date", + "properties.order_completed_time", + "properties.orderCompletedTime" + ], "destKey": "date" }, { - "sourceKeys": ["properties.altord", "properties.alterOrderId"], + "sourceKeys": [ + "properties.alt_ord", + "properties.altord", + "properties.alter_order_id", + "properties.alterOrderId" + ], "destKey": "altord" }, { @@ -27,15 +36,15 @@ "destKey": "cur" }, { - "sourceKeys": "properties.creditCardType", + "sourceKeys": ["properties.credit_card_type", "properties.creditCardType"], "destKey": "cc" }, { - "sourceKeys": "properties.commReason", + "sourceKeys": ["properties.comm_reason", "properties.commReason"], "destKey": "commreason" }, { - "sourceKeys": "properties.isComm", + "sourceKeys": ["properties.is_comm", "properties.isComm"], "destKey": "iscomm" }, { @@ -47,27 +56,48 @@ "destKey": "coupon" }, { - "sourceKeys": ["properties.custId", "properties.customerId", "properties.userId"], + "sourceKeys": [ + "properties.cust_id", + "properties.custId", + "properties.customer_id", + "properties.customerId", + "properties.userId" + ], "destKey": "custid" }, { - "sourceKeys": ["properties.custScore", "properties.customerScore"], + "sourceKeys": [ + "properties.cust_score", + "properties.custScore", + "properties.customer_score", + "properties.customerScore" + ], "destKey": "custscore" }, { - "sourceKeys": ["properties.custStatus", "properties.customerStatus"], + "sourceKeys": [ + "properties.cust_status", + "properties.custStatus", + "properties.customer_status", + "properties.customerStatus" + ], "destKey": "custstatus" }, { - "sourceKeys": ["properties.dId", "properties.advertisingId"], + "sourceKeys": ["properties.dId", "properties.advertising_id", "properties.advertisingId"], "destKey": "did" }, { - "sourceKeys": ["properties.disamt", "properties.discountAmout"], + "sourceKeys": ["properties.disamt", "properties.discount_amount", "properties.discountAmount"], "destKey": "disamt" }, { - "sourceKeys": ["properties.ordStatus", "properties.orderStatus"], + "sourceKeys": [ + "properties.ord_status", + "properties.ordStatus", + "properties.order_status", + "properties.orderStatus" + ], "destKey": "ordstatus" }, { @@ -75,7 +105,7 @@ "destKey": "segment" }, { - "sourceKeys": "properties.shipcountry", + "sourceKeys": ["properties.ship_country", "properties.shipcountry"], "destKey": "shipcountry" }, { @@ -83,15 +113,25 @@ "destKey": "shipped" }, { - "sourceKeys": ["properties.sitename", "properties.url", "context.page.url"], + "sourceKeys": [ + "properties.site_name", + "properties.sitename", + "properties.url", + "context.page.url" + ], "destKey": "sitename" }, { - "sourceKeys": "properties.storeId", + "sourceKeys": ["properties.store_id", "properties.storeId"], "destKey": "storeid" }, { - "sourceKeys": ["properties.storecat", "properties.storeCategory"], + "sourceKeys": [ + "properties.store_cat", + "properties.storecat", + "properties.store_category", + "properties.storeCategory" + ], "destKey": "storecat" }, { diff --git a/test/integrations/destinations/rakuten/processor/transformationFailure.ts b/test/integrations/destinations/rakuten/processor/transformationFailure.ts index 906ddafd6a..e35ab26b69 100644 --- a/test/integrations/destinations/rakuten/processor/transformationFailure.ts +++ b/test/integrations/destinations/rakuten/processor/transformationFailure.ts @@ -46,7 +46,7 @@ export const transformationFailures = [ body: [ { error: - 'Missing required value from "properties.orderId": Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: undefined, OriginalError: Missing required value from "properties.orderId"', + 'Missing required value from ["properties.order_id","properties.orderId"]: Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: undefined, OriginalError: Missing required value from ["properties.order_id","properties.orderId"]', metadata: { destinationId: 'dummyDestId', jobId: '1', @@ -245,7 +245,7 @@ export const transformationFailures = [ body: [ { error: - 'Missing required value from ["properties.tr","properties.ranSiteID"]: Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: undefined, OriginalError: Missing required value from ["properties.tr","properties.ranSiteID"]', + 'Missing required value from ["properties.tr","properties.ran_site_id","properties.ranSiteID"]: Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: undefined, OriginalError: Missing required value from ["properties.tr","properties.ran_site_id","properties.ranSiteID"]', metadata: { destinationId: 'dummyDestId', jobId: '1', @@ -312,7 +312,7 @@ export const transformationFailures = [ body: [ { error: - 'Missing required value from ["properties.land","properties.landTime"]: Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: undefined, OriginalError: Missing required value from ["properties.land","properties.landTime"]', + 'Missing required value from ["properties.land","properties.land_time","properties.landTime"]: Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: undefined, OriginalError: Missing required value from ["properties.land","properties.land_time","properties.landTime"]', metadata: { destinationId: 'dummyDestId', jobId: '1',