From 12be1a59897d1bb65dc756dd4d43b2a99d438aac Mon Sep 17 00:00:00 2001 From: nisar Date: Wed, 12 Apr 2023 10:32:51 +0530 Subject: [PATCH] vidoomy adapter: added userid module --- modules/vidoomyBidAdapter.js | 7 +++++++ test/spec/modules/vidoomyBidAdapter_spec.js | 23 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/modules/vidoomyBidAdapter.js b/modules/vidoomyBidAdapter.js index 29128998fd1..ded89861217 100644 --- a/modules/vidoomyBidAdapter.js +++ b/modules/vidoomyBidAdapter.js @@ -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, @@ -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? diff --git a/test/spec/modules/vidoomyBidAdapter_spec.js b/test/spec/modules/vidoomyBidAdapter_spec.js index 607fdf4b5b8..2886800d001 100644 --- a/test/spec/modules/vidoomyBidAdapter_spec.js +++ b/test/spec/modules/vidoomyBidAdapter_spec.js @@ -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];