diff --git a/modules/docereeAdManagerBidAdapter.js b/modules/docereeAdManagerBidAdapter.js index d115e785969..d7a28d6b788 100644 --- a/modules/docereeAdManagerBidAdapter.js +++ b/modules/docereeAdManagerBidAdapter.js @@ -20,12 +20,12 @@ export const spec = { } return true; }, - buildRequests: (validBidRequests) => { + buildRequests: (validBidRequests, bidderRequest) => { const serverRequests = []; const { data } = config.getConfig('docereeadmanager.user') || {}; validBidRequests.forEach(function (validBidRequest) { - const payload = getPayload(validBidRequest, data); + const payload = getPayload(validBidRequest, data, bidderRequest); if (!payload) { return; @@ -70,7 +70,7 @@ export const spec = { }, }; -export function getPayload(bid, userData) { +export function getPayload(bid, userData, bidderRequest) { if (!userData || !bid) { return false; } @@ -123,6 +123,19 @@ export function getPayload(bid, userData) { mobile: mobile || '', pageurl: publisherUrl || '' }; + + try { + if (bidderRequest && bidderRequest.gdprConsent) { + const { gdprApplies, consentString } = bidderRequest.gdprConsent; + data['consent'] = { + 'gdpr': gdprApplies ? 1 : 0, + 'gdprstr': consentString || '', + } + } + } catch (error) { + + } + return { data, }; diff --git a/test/spec/modules/docereeAdManagerBidAdapter_spec.js b/test/spec/modules/docereeAdManagerBidAdapter_spec.js index b231d5572bf..268e30f542d 100644 --- a/test/spec/modules/docereeAdManagerBidAdapter_spec.js +++ b/test/spec/modules/docereeAdManagerBidAdapter_spec.js @@ -149,7 +149,13 @@ describe('docereeadmanager', function () { mobile: 'XXXXXXXXXX', } bid = {...bid, params: {...bid.params, placementId: 'DOC-19-1'}} - const payload = getPayload(bid, data); + const buildRequests = { + gdprConsent: { + consentString: 'COwK6gaOwK6gaFmAAAENAPCAAAAAAAAAAAAAAAAAAAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw', + gdprApplies: false + } + } + const payload = getPayload(bid, data, buildRequests); const payloadData = payload.data; expect(payloadData).to.have.all.keys( 'userid', @@ -174,7 +180,8 @@ describe('docereeadmanager', function () { 'dob', 'userconsent', 'mobile', - 'pageurl' + 'pageurl', + 'consent' ); expect(payloadData.userid).to.equal('Xx.xxx.xxxxxx'); expect(payloadData.email).to.equal('xxxx@mail.com'); @@ -199,6 +206,8 @@ describe('docereeadmanager', function () { expect(payloadData.mobile).to.equal('XXXXXXXXXX'); expect(payloadData.adunit).to.equal('DOC-19-1'); expect(payloadData.pageurl).to.equal('xxxxxx.com/xxxx'); + expect(payloadData.consent.gdprstr).to.equal('COwK6gaOwK6gaFmAAAENAPCAAAAAAAAAAAAAAAAAAAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw'); + expect(payloadData.consent.gdpr).to.equal(0); }) }) });