Skip to content

Commit

Permalink
Doceree AdManager Bid Adapter : maintainence (#12578)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Patrick McCann <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent 22ced7d commit eee512b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
23 changes: 17 additions & 6 deletions modules/docereeAdManagerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = {
Expand All @@ -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 {
Expand Down
11 changes: 4 additions & 7 deletions test/spec/modules/docereeAdManagerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('docereeadmanager', function () {
city: '',
state: '',
zipcode: '',
hashedNPI: '',
hashedhcpid: '',
hashedemail: '',
hashedmobile: '',
Expand Down Expand Up @@ -146,7 +145,6 @@ describe('docereeadmanager', function () {
city: 'Xxxxx',
state: 'Xxxxxx',
zipcode: 'XXXXXX',
hashedNPI: 'xxxxxx',
hashedhcpid: 'xxxxxxx',
hashedemail: 'xxxxxxx',
hashedmobile: 'xxxxxxx',
Expand All @@ -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 = {
Expand All @@ -177,7 +176,6 @@ describe('docereeadmanager', function () {
'city',
'state',
'zipcode',
'hashedNPI',
'pb',
'adunit',
'requestId',
Expand All @@ -187,7 +185,7 @@ describe('docereeadmanager', function () {
'country',
'organization',
'dob',
'userconsent',
'upref',
'mobile',
'pageurl',
'consent'
Expand All @@ -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');
Expand All @@ -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);
})
Expand Down

0 comments on commit eee512b

Please sign in to comment.