From e03511745d043260eb71fc26ee346d86dee72d0b Mon Sep 17 00:00:00 2001 From: ako-adot <90328748+ako-adot@users.noreply.github.com> Date: Fri, 8 Jul 2022 14:02:21 +0200 Subject: [PATCH] [DSP-3689] feature: add pubProvidedId to user (#6) [DSP-3689] feature: add pubProvidedId to user --- modules/adotBidAdapter.js | 8 +++++++- test/spec/modules/adotBidAdapter_spec.js | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/adotBidAdapter.js b/modules/adotBidAdapter.js index 869cd69a830..c8dcb7b708f 100644 --- a/modules/adotBidAdapter.js +++ b/modules/adotBidAdapter.js @@ -83,7 +83,13 @@ function getOpenRTBDeviceObject() { */ function getOpenRTBUserObject(bidderRequest) { if (!bidderRequest || !bidderRequest.gdprConsent || !isStr(bidderRequest.gdprConsent.consentString)) return null; - return { ext: { consent: bidderRequest.gdprConsent.consentString } }; + + return { + ext: { + consent: bidderRequest.gdprConsent.consentString, + pubProvidedId: bidderRequest.userId && bidderRequest.userId.pubProvidedId, + }, + }; } /** diff --git a/test/spec/modules/adotBidAdapter_spec.js b/test/spec/modules/adotBidAdapter_spec.js index 8851df37d34..d5fc098d005 100644 --- a/test/spec/modules/adotBidAdapter_spec.js +++ b/test/spec/modules/adotBidAdapter_spec.js @@ -28,7 +28,7 @@ describe('Adot Adapter', function () { it('should build request (banner)', function () { const bidderRequestId = 'bidderRequestId'; const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { banner: { sizes: [[300, 250]] } }, params: { placementId: 'placementId', adUnitCode: 200 } }]; - const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } }; + const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true }, userId: { pubProvidedId: 'userId' } }; const request = spec.buildRequests(validBidRequests, bidderRequest); const buildBidRequestResponse = { @@ -57,7 +57,7 @@ describe('Adot Adapter', function () { } }, device: { ua: navigator.userAgent, language: navigator.language }, - user: { ext: { consent: bidderRequest.gdprConsent.consentString } }, + user: { ext: { consent: bidderRequest.gdprConsent.consentString, pubProvidedId: 'userId' } }, regs: { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies } }, ext: { adot: { adapter_version: 'v2.0.0' }, @@ -76,7 +76,7 @@ describe('Adot Adapter', function () { it('should build request (native)', function () { const bidderRequestId = 'bidderRequestId'; const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { native: { title: { required: true, len: 50, sizes: [[300, 250]] }, wrong: {}, image: {} } }, params: { placementId: 'placementId', adUnitCode: 200 } }]; - const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } }; + const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true }, userId: { pubProvidedId: 'userId' } }; const request = spec.buildRequests(validBidRequests, bidderRequest); const buildBidRequestResponse = { @@ -104,7 +104,7 @@ describe('Adot Adapter', function () { } }, device: { ua: navigator.userAgent, language: navigator.language }, - user: { ext: { consent: bidderRequest.gdprConsent.consentString } }, + user: { ext: { consent: bidderRequest.gdprConsent.consentString, pubProvidedId: 'userId' } }, regs: { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies } }, ext: { adot: { adapter_version: 'v2.0.0' }, @@ -123,7 +123,7 @@ describe('Adot Adapter', function () { it('should build request (video)', function () { const bidderRequestId = 'bidderRequestId'; const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { video: { playerSize: [[300, 250]], minduration: 1, maxduration: 2, api: 'api', linearity: 'linearity', mimes: [], placement: 'placement', playbackmethod: 'playbackmethod', protocols: 'protocol', startdelay: 'startdelay' } }, params: { placementId: 'placementId', adUnitCode: 200 } }]; - const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } }; + const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true }, userId: { pubProvidedId: 'userId' } }; const request = spec.buildRequests(validBidRequests, bidderRequest); const buildBidRequestResponse = { @@ -163,7 +163,7 @@ describe('Adot Adapter', function () { } }, device: { ua: navigator.userAgent, language: navigator.language }, - user: { ext: { consent: bidderRequest.gdprConsent.consentString } }, + user: { ext: { consent: bidderRequest.gdprConsent.consentString, pubProvidedId: 'userId' } }, regs: { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies } }, ext: { adot: { adapter_version: 'v2.0.0' },