Skip to content

Commit

Permalink
feat: now getting consent related fields from connection config from …
Browse files Browse the repository at this point in the history
…retl for GARL (#3877)
  • Loading branch information
sandeepdsvs authored Nov 13, 2024
1 parent 383584f commit 51bbc02
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const processRecordEventArray = (
typeOfList,
userSchema,
isHashRequired,
userDataConsent,
personalizationConsent,
operationType,
) => {
let outputPayloads = {};
Expand Down Expand Up @@ -81,7 +83,10 @@ const processRecordEventArray = (

const toSendEvents = [];
Object.values(outputPayloads).forEach((data) => {
const consentObj = populateConsentFromConfig(destination.Config, consentConfigMap);
const consentObj = populateConsentFromConfig(
{ userDataConsent, personalizationConsent },
consentConfigMap,
);
toSendEvents.push(
responseBuilder(accessToken, developerToken, data, destination, audienceId, consentObj),
);
Expand All @@ -96,7 +101,14 @@ function preparepayload(events, config) {
const { destination, message, metadata } = events[0];
const accessToken = getAccessToken(metadata, 'access_token');
const developerToken = getValueFromMessage(metadata, 'secret.developer_token');
const { audienceId, typeOfList, isHashRequired, userSchema } = config;
const {
audienceId,
typeOfList,
isHashRequired,
userSchema,
userDataConsent,
personalizationConsent,
} = config;

const groupedRecordsByAction = lodash.groupBy(events, (record) =>
record.message.action?.toLowerCase(),
Expand All @@ -117,6 +129,8 @@ function preparepayload(events, config) {
typeOfList,
userSchema,
isHashRequired,
userDataConsent,
personalizationConsent,
'remove',
);
}
Expand All @@ -132,6 +146,8 @@ function preparepayload(events, config) {
typeOfList,
userSchema,
isHashRequired,
userDataConsent,
personalizationConsent,
'add',
);
}
Expand All @@ -147,6 +163,8 @@ function preparepayload(events, config) {
typeOfList,
userSchema,
isHashRequired,
userDataConsent,
personalizationConsent,
'add',
);
}
Expand All @@ -169,19 +187,29 @@ function preparepayload(events, config) {

function processRecordInputsV0(groupedRecordInputs) {
const { destination, message } = groupedRecordInputs[0];
const { audienceId, typeOfList, isHashRequired, userSchema } = destination.Config;
const {
audienceId,
typeOfList,
isHashRequired,
userSchema,
userDataConsent,
personalizationConsent,
} = destination.Config;

return preparepayload(groupedRecordInputs, {
audienceId: getOperationAudienceId(audienceId, message),
typeOfList,
userSchema,
isHashRequired,
userDataConsent,
personalizationConsent,
});
}

function processRecordInputsV1(groupedRecordInputs) {
const { connection, message } = groupedRecordInputs[0];
const { audienceId, typeOfList, isHashRequired } = connection.config.destination;
const { audienceId, typeOfList, isHashRequired, userDataConsent, personalizationConsent } =
connection.config.destination;

const identifiers = message?.identifiers;
let userSchema;
Expand All @@ -202,6 +230,8 @@ function processRecordInputsV1(groupedRecordInputs) {
typeOfList,
userSchema,
isHashRequired,
userDataConsent,
personalizationConsent,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,8 @@ export const data = [
listId: '7090784486',
customerId: '7693729833',
consent: {
adPersonalization: 'UNSPECIFIED',
adUserData: 'UNSPECIFIED',
adPersonalization: 'GRANTED',
adUserData: 'GRANTED',
},
},
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const connection2: Connection = {
isHashRequired: true,
typeOfList: 'userID',
audienceId: '7090784486',
personalizationConsent: 'GRANTED',
userDataConsent: 'GRANTED',
},
},
};
Expand Down

0 comments on commit 51bbc02

Please sign in to comment.