Skip to content

Commit

Permalink
Merge branch 'hotfix/Dec.18' of github.com:rudderlabs/rudder-transfor…
Browse files Browse the repository at this point in the history
…mer into fix.rm-log-cdkv2
  • Loading branch information
Sai Sankeerth committed Dec 18, 2023
2 parents 0621c43 + 7f6d519 commit ceeeb69
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ bindings:
path: ../../../../v0/util
- name: removeUndefinedAndNullAndEmptyValues
path: ../../../../v0/util
- name: validateEventName
path: ../../../../v0/util
steps:
- name: checkIfProcessed
condition: .message.statusCode
Expand Down Expand Up @@ -175,6 +177,7 @@ steps:
name: eventNamesForOthers
template: |
let event = .message.event ?? .message.name;
$.validateEventName(event);
let eventInLowerCase = event.toLowerCase();
let eventNames = .destination.Config.eventsMapping.(){.from === event}.to[] ?? [];
eventNames = $.convertToSnakeCase(eventNames);
Expand Down Expand Up @@ -243,4 +246,4 @@ steps:
},
"params": $.outputs.checkSendTestEventConfig,
"files": {}
})[]
})[]
2 changes: 2 additions & 0 deletions src/v0/destinations/pinterest_tag/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
isDefined,
getHashFromArrayWithDuplicate,
removeUndefinedAndNullValues,
validateEventName,
} = require('../../util');
const { COMMON_CONFIGS, CUSTOM_CONFIGS, API_VERSION } = require('./config');

Expand Down Expand Up @@ -170,6 +171,7 @@ const deduceTrackScreenEventName = (message, Config) => {
if (!trackEventOrScreenName) {
throw new InstrumentationError('event_name could not be mapped. Aborting');
}
validateEventName(trackEventOrScreenName);

/*
Step 1: If the event is not amongst the above list of ecommerce events, will look for
Expand Down
125 changes: 125 additions & 0 deletions test/integrations/destinations/pinterest_tag/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3569,4 +3569,129 @@ export const data = [
},
},
},
{
name: 'pinterest_tag',
description: 'Test 3',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
description: 'Any other format of event except string should be aborted',
message: {
type: 'track',
event: [1, 2, 3],
sentAt: '2020-08-14T05:30:30.118Z',
channel: 'web',
context: {
source: 'test',
userAgent: 'chrome',
traits: {
anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1',
email: '[email protected]',
phone: '+1234589947',
ge: 'male',
db: '19950715',
lastname: 'Rudderlabs',
firstName: 'Test',
address: { city: 'Kolkata', state: 'WB', zip: '700114', country: 'IN' },
},
device: { advertisingId: 'abc123' },
library: { name: 'rudder-sdk-ruby-sync', version: '1.0.6' },
},
messageId: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9',
timestamp: '2020-08-14T05:30:30.118Z',
properties: {
tax: 2,
total: 27.5,
coupon: 'hasbros',
revenue: 48,
price: 25,
quantity: 2,
currency: 'USD',
discount: 2.5,
order_id: '50314b8e9bcf000000000000',
requestIP: '123.0.0.0',
optOutType: 'LDP',
products: [
{
sku: '45790-32',
url: 'https://www.example.com/product/path',
name: 'Monopoly: 3rd Edition',
price: 19,
category: 'Games',
quantity: 1,
image_url: 'https:///www.example.com/product/path.jpg',
product_id: '507f1f77bcf86cd799439011',
},
{
sku: '46493-32',
name: 'Uno Card Game',
price: 3,
category: 'Games',
quantity: 2,
product_id: '505bd76785ebb509fc183733',
},
],
shipping: 3,
subtotal: 22.5,
affiliation: 'Google Store',
checkout_id: 'fksdjfsdjfisjf9sdfjsd9f',
},
anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1',
integrations: { All: true },
},
destination: {
DestinationDefinition: { Config: { cdkV2Enabled: true } },
ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq',
Name: 'PINTEREST_TAG',
Config: {
sendAsTestEvent: false,
tagId: '123456789',
apiVersion: 'newApi',
adAccountId: 'accountId123',
conversionToken: 'conversionToken123',
appId: '429047995',
enhancedMatch: true,
enableDeduplication: true,
deduplicationKey: 'messageId',
sendingUnHashedData: true,
sendExternalId: true,
customProperties: [{ properties: 'presentclass' }, { properties: 'presentgrade' }],
eventsMapping: [{ from: 'ABC Searched', to: 'WatchVideo' }],
},
Enabled: true,
Transformations: [],
},
metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' },
},
],
method: 'POST',
},
pathSuffix: '',
},
output: {
response: {
status: 200,
body: [
{
error:
'Event is a required field and should be a string: Workflow: procWorkflow, Step: eventNames, ChildStep: undefined, OriginalError: Event is a required field and should be a string',
metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' },
statTags: {
destType: 'PINTEREST_TAG',
errorCategory: 'dataValidation',
errorType: 'instrumentation',
feature: 'processor',
implementation: 'cdkV2',
module: 'destination',
},
statusCode: 400,
},
],
},
},
},
];

0 comments on commit ceeeb69

Please sign in to comment.