Skip to content
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
11 changes: 10 additions & 1 deletion modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const spec = {
const chunkSize = deepAccess(adapterSettings, 'chunkSize', 10);
const { tag, bids } = bidToTag(bidRequests, adapterRequest);
const bidChunks = chunk(bids, chunkSize);

return _map(bidChunks, (bids) => {
return {
data: Object.assign({}, tag, { BidRequests: bids }),
Expand Down Expand Up @@ -129,23 +130,29 @@ function parseRTBResponse(serverResponse, adapterRequest) {
function bidToTag(bidRequests, adapterRequest) {
// start publisher env
const tag = createTag(bidRequests, adapterRequest);

if (window.adtDmp && window.adtDmp.ready) {
tag.DMPId = window.adtDmp.getUID();
}

if (adapterRequest.gppConsent) {
tag.GPP = adapterRequest.gppConsent.gppString;
tag.GPPSid = adapterRequest.gppConsent.applicableSections?.toString();
} else if (adapterRequest.ortb2?.regs?.gpp) {
tag.GPP = adapterRequest.ortb2.regs.gpp;
tag.GPPSid = adapterRequest.ortb2.regs.gpp_sid;
}
const ageVerification = deepAccess(adapterRequest, 'ortb2.regs.ext.age_verification');

if (ageVerification) {
tag.AgeVerification = ageVerification;
}

// end publisher env
const bids = [];

for (let i = 0, length = bidRequests.length; i < length; i++) {
const bid = prepareBidRequests(bidRequests[i]);

bids.push(bid);
}

Expand Down Expand Up @@ -176,10 +183,12 @@ function prepareBidRequests(bidReq) {
}
if (mediaType === VIDEO) {
const context = deepAccess(bidReq, 'mediaTypes.video.context');

if (context === ADPOD) {
bidReqParams.Adpod = deepAccess(bidReq, 'mediaTypes.video');
}
}

return bidReqParams;
}

Expand Down
18 changes: 17 additions & 1 deletion test/spec/modules/adtelligentBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ const displayBidderRequest = {
bids: [{ bidId: '2e41f65424c87c' }]
};

const ageVerificationData = {
id: "123456789123456789",
status: "accepted",
decisionDate: "2011-10-05T14:48:00.000Z"
};

const displayBidderRequestWithConsents = {
bidderCode: 'bidderCode',
bids: [{ bidId: '2e41f65424c87c' }],
Expand All @@ -155,7 +161,14 @@ const displayBidderRequestWithConsents = {
gppString: 'abc12345234',
applicableSections: [7, 8]
},
uspConsent: 'iHaveIt'
uspConsent: 'iHaveIt',
ortb2: {
regs: {
ext: {
age_verification: ageVerificationData
}
}
}
};

const videoEqResponse = [{
Expand Down Expand Up @@ -379,6 +392,9 @@ describe('adtelligentBidAdapter', () => {
it('sets UserId\'s', () => {
expect(bidRequestWithPubSettingsData.UserIds).to.be.deep.equal(DISPLAY_REQUEST.userId);
})
it('sets AgeVerification', () => {
expect(bidRequestWithPubSettingsData.AgeVerification).to.deep.equal(ageVerificationData);
});
})
});

Expand Down