From 2266d147e0931a1193b5850cb5971b88aa95bc45 Mon Sep 17 00:00:00 2001 From: Surovenko Alexey Date: Mon, 24 May 2021 15:51:28 +0600 Subject: [PATCH 1/3] SharedId implementation --- modules/zetaSspBidAdapter.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/zetaSspBidAdapter.js b/modules/zetaSspBidAdapter.js index 450608a82f4..30f4622e554 100644 --- a/modules/zetaSspBidAdapter.js +++ b/modules/zetaSspBidAdapter.js @@ -42,7 +42,7 @@ export const spec = { const secure = 1; // treat all requests as secure const request = validBidRequests[0]; const params = request.params; - let impData = { + const impData = { id: request.bidId, secure: secure, banner: buildBanner(request) @@ -83,6 +83,7 @@ export const spec = { } }; } + provideSharedId(request, payload); return { method: 'POST', url: ENDPOINT_URL, @@ -156,4 +157,10 @@ function buildBanner(request) { }; } +function provideSharedId(request, payload) { + if (Array.isArray(request.userIdAsEids) && request.userIdAsEids.length > 0) { + utils.deepSetValue(payload, 'user.ext.eids', request.userIdAsEids); + } +} + registerBidder(spec); From 051534837aee58159b843d944e169b5b480613f7 Mon Sep 17 00:00:00 2001 From: Surovenko Alexey Date: Tue, 25 May 2021 02:35:13 +0600 Subject: [PATCH 2/3] Test added --- test/spec/modules/zetaSspBidAdapter_spec.js | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/test/spec/modules/zetaSspBidAdapter_spec.js b/test/spec/modules/zetaSspBidAdapter_spec.js index bdfc64c3234..4273187fea3 100644 --- a/test/spec/modules/zetaSspBidAdapter_spec.js +++ b/test/spec/modules/zetaSspBidAdapter_spec.js @@ -1,6 +1,28 @@ import { spec } from '../../../modules/zetaSspBidAdapter.js' describe('Zeta Ssp Bid Adapter', function() { + const eids = [ + { + 'source': 'example.com', + 'uids': [ + { + 'id': 'someId1', + 'atype': 1 + }, + { + 'id': 'someId2', + 'atype': 1 + }, + { + 'id': 'someId3', + 'atype': 2 + } + ], + 'ext': { + 'foo': 'bar' + } + } + ]; const bannerRequest = [{ bidId: 12345, auctionId: 67890, @@ -23,7 +45,8 @@ describe('Zeta Ssp Bid Adapter', function() { sid: 'publisherId' }, test: 1 - } + }, + userIdAsEids: eids }]; it('Test the bid validation function', function() { @@ -34,6 +57,12 @@ describe('Zeta Ssp Bid Adapter', function() { expect(invalidBid).to.be.false; }); + it('Test provide eids', function () { + const request = spec.buildRequests(bannerRequest, bannerRequest[0]); + const payload = JSON.parse(request.data); + expect(payload.user.ext.eids).to.eql(eids); + }); + it('Test the request processing function', function () { const request = spec.buildRequests(bannerRequest, bannerRequest[0]); expect(request).to.not.be.empty; From 84036f6d0d4af7632b890c0e3e8fd98941be9ff5 Mon Sep 17 00:00:00 2001 From: Surovenko Alexey Date: Tue, 25 May 2021 14:27:38 +0600 Subject: [PATCH 3/3] rename function to provideEids --- modules/zetaSspBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/zetaSspBidAdapter.js b/modules/zetaSspBidAdapter.js index 30f4622e554..f83bc26ff3f 100644 --- a/modules/zetaSspBidAdapter.js +++ b/modules/zetaSspBidAdapter.js @@ -83,7 +83,7 @@ export const spec = { } }; } - provideSharedId(request, payload); + provideEids(request, payload); return { method: 'POST', url: ENDPOINT_URL, @@ -157,7 +157,7 @@ function buildBanner(request) { }; } -function provideSharedId(request, payload) { +function provideEids(request, payload) { if (Array.isArray(request.userIdAsEids) && request.userIdAsEids.length > 0) { utils.deepSetValue(payload, 'user.ext.eids', request.userIdAsEids); }