Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: now getting consent related fields from connection config from retl for GARL #3877

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading