diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js index 98a0e290575..dd96353dea3 100644 --- a/modules/eplanningBidAdapter.js +++ b/modules/eplanningBidAdapter.js @@ -82,9 +82,12 @@ export const spec = { if (bidderRequest && bidderRequest.uspConsent) { params.ccpa = bidderRequest.uspConsent; } - const userIds = (getGlobal()).getUserIds(); - for (var id in userIds) { - params['e_' + id] = (typeof userIds[id] === 'object') ? encodeURIComponent(JSON.stringify(userIds[id])) : encodeURIComponent(userIds[id]); + + if ((getGlobal()).getUserIds && typeof (getGlobal()).getUserIds === 'function') { + const userIds = (getGlobal()).getUserIds(); + for (var id in userIds) { + params['e_' + id] = (typeof userIds[id] === 'object') ? encodeURIComponent(JSON.stringify(userIds[id])) : encodeURIComponent(userIds[id]); + } } } @@ -114,6 +117,11 @@ export const spec = { netRevenue: NET_REVENUE, currency: DOLLARS, }; + if (ad.adom) { + bidResponse.meta = { + advertiserDomains: ad.adom + }; + } bidResponses.push(bidResponse); }); } diff --git a/test/spec/modules/eplanningBidAdapter_spec.js b/test/spec/modules/eplanningBidAdapter_spec.js index 1d3a8344170..6aa191f29a5 100644 --- a/test/spec/modules/eplanningBidAdapter_spec.js +++ b/test/spec/modules/eplanningBidAdapter_spec.js @@ -26,6 +26,7 @@ describe('E-Planning Adapter', function () { const I_ID = '7854abc56248f873'; const CRID = '1234567890'; const TEST_ISV = 'leles.e-planning.net'; + const ADOMAIN = 'adomain.com'; const validBid = { 'bidder': 'eplanning', 'bidId': BID_ID, @@ -237,6 +238,39 @@ describe('E-Planning Adapter', function () { ] } }; + const responseWithAdomain = { + body: { + 'sI': { + 'k': '12345' + }, + 'sec': { + 'k': 'ROS' + }, + 'sp': [{ + 'k': CLEAN_ADUNIT_CODE, + 'a': [{ + 'adm': ADM, + 'id': '7854abc56248f874', + 'i': I_ID, + 'fi': '7854abc56248f872', + 'ip': '45621afd87462104', + 'w': W, + 'h': H, + 'crid': CRID, + 'pr': CPM, + 'adom': ADOMAIN + }], + }], + 'cs': [ + 'http://a-sync-url.com/', + { + 'u': 'http://another-sync-url.com/test.php?&partner=123456&endpoint=us-east', + 'ifr': true + } + ] + } + }; + const responseWithNoSpace = { body: { 'sI': { @@ -520,6 +554,25 @@ describe('E-Planning Adapter', function () { }; expect(bidResponse).to.deep.equal(expectedResponse); }); + + it('should pass advertiserDomains when present', function () { + const bidResponse = spec.interpretResponse(responseWithAdomain, { adUnitToBidId: { [CLEAN_ADUNIT_CODE]: BID_ID } })[0]; + const expectedResponse = { + requestId: BID_ID, + cpm: CPM, + width: W, + height: H, + ad: ADM, + ttl: 120, + creativeId: CRID, + netRevenue: true, + currency: 'USD', + meta: { + advertiserDomains: ADOMAIN + } + }; + expect(bidResponse).to.deep.equal(expectedResponse); + }); }); describe('getUserSyncs', function () {