Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeta Ssp Bid Adapter: support for eids #6819

Merged
merged 10 commits into from
May 28, 2021
9 changes: 8 additions & 1 deletion modules/zetaSspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -83,6 +83,7 @@ export const spec = {
}
};
}
provideEids(request, payload);
return {
method: 'POST',
url: ENDPOINT_URL,
Expand Down Expand Up @@ -156,4 +157,10 @@ function buildBanner(request) {
};
}

function provideEids(request, payload) {
if (Array.isArray(request.userIdAsEids) && request.userIdAsEids.length > 0) {
utils.deepSetValue(payload, 'user.ext.eids', request.userIdAsEids);
}
}

registerBidder(spec);
31 changes: 30 additions & 1 deletion test/spec/modules/zetaSspBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -23,7 +45,8 @@ describe('Zeta Ssp Bid Adapter', function() {
sid: 'publisherId'
},
test: 1
}
},
userIdAsEids: eids
}];

it('Test the bid validation function', function() {
Expand All @@ -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;
Expand Down