Skip to content

Commit

Permalink
vidoomy adapter: added userid module (#9795)
Browse files Browse the repository at this point in the history
  • Loading branch information
nisart007 authored Apr 18, 2023
1 parent 0d1af3b commit b94ca25
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/vidoomyBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ const buildRequests = (validBidRequests, bidderRequest) => {
const bidfloor = deepAccess(bid, `params.bidfloor`, 0);
const floor = getBidFloor(bid, adType, sizes, bidfloor);

let eids;
const userEids = deepAccess(bid, 'userIdAsEids');
if (Array.isArray(userEids) && userEids.length > 0) {
eids = JSON.stringify(userEids) || '';
}

const queryParams = {
id: bid.params.id,
adtype: adType,
Expand All @@ -141,6 +147,7 @@ const buildRequests = (validBidRequests, bidderRequest) => {
pid: bid.params.pid,
requestId: bid.bidId,
schain: serializeSupplyChainObj(bid.schain) || '',
eids: eids || '',
bidfloor: floor,
d: getDomainWithoutSubdomain(hostname), // 'vidoomy.com',
// TODO: does the fallback make sense here?
Expand Down
23 changes: 23 additions & 0 deletions test/spec/modules/vidoomyBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,29 @@ describe('vidoomyBidAdapter', function() {
expect(request[0].data.schain).to.eq(serializedForm);
});

it('should return standard json formated eids', function () {
const eids = [{
source: 'pubcid.org',
uids: [
{
id: 'some-random-id-value-1',
atype: 1
}
]
},
{
source: 'adserver.org',
uids: [{
id: 'some-random-id-value-2',
atype: 1
}]
}]
bidRequests[0].userIdAsEids = eids
const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
expect(bidRequest[0].data).to.include.any.keys('eids');
expect(JSON.parse(bidRequest[0].data.eids)).to.eql(eids);
});

it('should set the bidfloor if getFloor module is undefined but static bidfloor is present', function () {
const request = { ...bidRequests[0], params: { bidfloor: 2.5 } }
const req = spec.buildRequests([request], bidderRequest)[0];
Expand Down

0 comments on commit b94ca25

Please sign in to comment.