Skip to content

Commit

Permalink
docereeAdManager Bid Adapter : updated bid adapter (#12333)
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

---------

Co-authored-by: lokesh-doceree <[email protected]>
Co-authored-by: Patrick McCann <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent fa44eac commit c90f9b3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
12 changes: 11 additions & 1 deletion modules/docereeAdManagerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ export const spec = {
},
};

export function getPageUrl() {
let url = '';
try {
url = window.location.href;
} catch (error) {
}
return url;
}

export function getPayload(bid, userData, bidderRequest) {
if (!userData || !bid) {
return false;
}

const { bidId, params } = bid;
const { placementId, publisherUrl } = params;
const {
Expand Down Expand Up @@ -121,7 +131,7 @@ export function getPayload(bid, userData, bidderRequest) {
dob: dob || '',
userconsent: 1,
mobile: mobile || '',
pageurl: publisherUrl || ''
pageurl: publisherUrl || getPageUrl() || ''
};

try {
Expand Down
17 changes: 13 additions & 4 deletions test/spec/modules/docereeAdManagerBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import { spec, getPayload } from '../../../modules/docereeAdManagerBidAdapter.js';
import { spec, getPayload, getPageUrl } from '../../../modules/docereeAdManagerBidAdapter.js';
import { config } from '../../../src/config.js';
import * as utils from '../../../src/utils.js';

describe('docereeadmanager', function () {
config.setConfig({
Expand Down Expand Up @@ -125,8 +126,15 @@ describe('docereeadmanager', function () {
});
});

describe('payload', function() {
it('should return payload with the correct data', function() {
describe('getPageUrl', function () {
it('should return an url string', function () {
const result = getPageUrl();
expect(result).to.equal(utils.getWindowSelf().location.href);
});
});

describe('payload', function () {
it('should return payload with the correct data', function () {
const data = {
userId: 'xxxxx',
email: '[email protected]',
Expand All @@ -148,14 +156,15 @@ describe('docereeadmanager', function () {
platformUid: 'Xx.xxx.xxxxxx',
mobile: 'XXXXXXXXXX',
}
bid = {...bid, params: {...bid.params, placementId: 'DOC-19-1'}}
bid = { ...bid, params: { ...bid.params, placementId: 'DOC-19-1' } }
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',
Expand Down

0 comments on commit c90f9b3

Please sign in to comment.