Skip to content

Commit

Permalink
adjusted formatting per ad server's request; consolodated assignment …
Browse files Browse the repository at this point in the history
…of trade desk id
  • Loading branch information
lbenmore committed Jun 24, 2021
1 parent d5cdc8d commit 37689c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
7 changes: 3 additions & 4 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function _getFloor (mediaTypes, staticBidFloor, bid) {

function getEids (userId) {
return Object.keys(userId).reduce(function (eids, provider) {
if (provider.id) eids[provider] = userId[provider].id;
if (userId[provider]) eids[provider] = userId[provider];
return eids;
}, {});
}
Expand Down Expand Up @@ -252,13 +252,12 @@ function buildRequests (validBidRequests, bidderRequest) {
ortb2Imp
} = bidRequest;
const { currency, floor } = _getFloor(mediaTypes, params.bidfloor, bidRequest);
const eids = [];
const eids = getEids(userId);
let sizes = [1, 1];
let data = {};
let gpid = '';

// ADTS-134 Fetch DIL Envelope for Client Side Header Bidding
eids.push.apply(eids, getEids(userId));
// ADTS-134 Retrieve ID envelopes
for (const eid in eids) data[eid] = eids[eid];

// ADJS-1024
Expand Down
31 changes: 15 additions & 16 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,6 @@ describe('gumgumAdapter', function () {
const zoneParam = { 'zone': '123a' };
const pubIdParam = { 'pubId': 123 };

it('should send IDL envelope ID if available', function () {
const idl_env = 'abc123';
const request = { ...bidRequests[0], userId: { idl_env } };
const bidRequest = spec.buildRequests([request])[0];

expect(bidRequest.data).to.have.property('idl_env');
expect(bidRequest.data.idl_env).to.equal(idl_env);
});

it('should not send IDL envelope if not available', function () {
const request = { ...bidRequests[0] };
const bidRequest = spec.buildRequests([request])[0];

expect(bidRequest.data).to.not.have.property('idl_env');
});

it('should set pubId param if found', function () {
const request = { ...bidRequests[0], params: pubIdParam };
const bidRequest = spec.buildRequests([request])[0];
Expand Down Expand Up @@ -463,6 +447,21 @@ describe('gumgumAdapter', function () {
const request = spec.buildRequests(bidRequests)[0];
expect(request.data).to.not.include.any.keys('tdid');
});
it('should send IDL envelope ID if available', function () {
const idl_env = 'abc123';
const request = { ...bidRequests[0], userId: { idl_env } };
const bidRequest = spec.buildRequests([request])[0];

expect(bidRequest.data).to.have.property('idl_env');
expect(bidRequest.data.idl_env).to.equal(idl_env);
});

it('should not send IDL envelope if not available', function () {
const request = { ...bidRequests[0] };
const bidRequest = spec.buildRequests([request])[0];

expect(bidRequest.data).to.not.have.property('idl_env');
});
it('should send schain parameter in serialized form', function () {
const serializedForm = '1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com!exchange2.com,abcd,1,bid-request-2,intermediary,intermediary.com'
const request = spec.buildRequests(bidRequests)[0];
Expand Down

0 comments on commit 37689c4

Please sign in to comment.