From eee512be13bdfdfc63c69afb885837524efc423c Mon Sep 17 00:00:00 2001 From: Doceree-techStack <143162581+Doceree-techStack@users.noreply.github.com> Date: Thu, 19 Dec 2024 23:29:06 +0530 Subject: [PATCH] Doceree AdManager Bid Adapter : maintainence (#12578) * Updated docereeAdManager bid adapter * Updated docereeAdManager bid adapter * Updated docereeAdManager bid adapter * Updated docereeAdManager bid adapter * Updated docereeAdManager bid adapter * Updated docereeAdManager bid adapter * Update docereeAdManagerBidAdapter.js * added test cases for payload formation in DocereeAdManager * Added support for publisherUrl * added some parameters * Added support for TCF 2.2 * Update docereeAdManagerBidAdapter.js * Update docereeAdManagerBidAdapter.js * Update docereeAdManagerBidAdapter.js * Written test cases for new method implemented. * indentation issues resolved * Update docereeAdManagerBidAdapter_spec.js * Update docereeAdManagerBidAdapter_spec.js * Update docereeAdManagerBidAdapter_spec.js * Updated DocereeAdManager Bidder Adapter * Update docereeAdManagerBidAdapter.js --------- Co-authored-by: lokesh-doceree Co-authored-by: Patrick McCann --- modules/docereeAdManagerBidAdapter.js | 23 ++++++++++++++----- .../docereeAdManagerBidAdapter_spec.js | 11 ++++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/docereeAdManagerBidAdapter.js b/modules/docereeAdManagerBidAdapter.js index e26045c8f1f..80f70d71a8b 100644 --- a/modules/docereeAdManagerBidAdapter.js +++ b/modules/docereeAdManagerBidAdapter.js @@ -79,6 +79,17 @@ export function getPageUrl() { return url; } +const handleConsent = (consentValue) => { + try { + if (consentValue === 0 || consentValue === '0') { + consentValue = '0'; + } + } catch (error) { + + } + return consentValue; +} + export function getPayload(bid, userData, bidderRequest) { if (!userData || !bid) { return false; @@ -98,14 +109,15 @@ export function getPayload(bid, userData, bidderRequest) { city, state, zipcode, - hashedNPI, hashedhcpid, hashedemail, hashedmobile, country, + hashedNPI, organization, platformUid, - mobile + mobile, + userconsent } = userData; const data = { @@ -119,19 +131,18 @@ export function getPayload(bid, userData, bidderRequest) { city: city || '', state: state || '', zipcode: zipcode || '', - hashedNPI: hashedNPI || '', pb: 1, adunit: placementId || '', requestId: bidId || '', - hashedhcpid: hashedhcpid || '', + hashedhcpid: hashedhcpid || hashedNPI || '', hashedemail: hashedemail || '', hashedmobile: hashedmobile || '', country: country || '', organization: organization || '', dob: dob || '', - userconsent: 1, + upref: handleConsent(userconsent) || '', mobile: mobile || '', - pageurl: publisherUrl || getPageUrl() || '' + pageurl: getPageUrl() || publisherUrl || '' }; try { diff --git a/test/spec/modules/docereeAdManagerBidAdapter_spec.js b/test/spec/modules/docereeAdManagerBidAdapter_spec.js index 704b9c48d3a..6f7da056681 100644 --- a/test/spec/modules/docereeAdManagerBidAdapter_spec.js +++ b/test/spec/modules/docereeAdManagerBidAdapter_spec.js @@ -18,7 +18,6 @@ describe('docereeadmanager', function () { city: '', state: '', zipcode: '', - hashedNPI: '', hashedhcpid: '', hashedemail: '', hashedmobile: '', @@ -146,7 +145,6 @@ describe('docereeadmanager', function () { city: 'Xxxxx', state: 'Xxxxxx', zipcode: 'XXXXXX', - hashedNPI: 'xxxxxx', hashedhcpid: 'xxxxxxx', hashedemail: 'xxxxxxx', hashedmobile: 'xxxxxxx', @@ -155,6 +153,7 @@ describe('docereeadmanager', function () { dob: 'xx-xx-xxxx', platformUid: 'Xx.xxx.xxxxxx', mobile: 'XXXXXXXXXX', + userconsent: 1 } bid = { ...bid, params: { ...bid.params, placementId: 'DOC-19-1' } } const buildRequests = { @@ -177,7 +176,6 @@ describe('docereeadmanager', function () { 'city', 'state', 'zipcode', - 'hashedNPI', 'pb', 'adunit', 'requestId', @@ -187,7 +185,7 @@ describe('docereeadmanager', function () { 'country', 'organization', 'dob', - 'userconsent', + 'upref', 'mobile', 'pageurl', 'consent' @@ -202,9 +200,8 @@ describe('docereeadmanager', function () { expect(payloadData.city).to.equal('Xxxxx'); expect(payloadData.state).to.equal('Xxxxxx'); expect(payloadData.zipcode).to.equal('XXXXXX'); - expect(payloadData.hashedNPI).to.equal('xxxxxx'); expect(payloadData.pb).to.equal(1); - expect(payloadData.userconsent).to.equal(1); + expect(payloadData.upref).to.equal(1); expect(payloadData.dob).to.equal('xx-xx-xxxx'); expect(payloadData.organization).to.equal('Xxxxxx'); expect(payloadData.country).to.equal('Xxxxxx'); @@ -214,7 +211,7 @@ describe('docereeadmanager', function () { expect(payloadData.requestId).to.equal('testing'); expect(payloadData.mobile).to.equal('XXXXXXXXXX'); expect(payloadData.adunit).to.equal('DOC-19-1'); - expect(payloadData.pageurl).to.equal('xxxxxx.com/xxxx'); + expect(payloadData.pageurl).to.equal('http://localhost:9876/context.html'); expect(payloadData.consent.gdprstr).to.equal('COwK6gaOwK6gaFmAAAENAPCAAAAAAAAAAAAAAAAAAAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw'); expect(payloadData.consent.gdpr).to.equal(0); })