Skip to content

Commit

Permalink
YieldOne Bid Adapter: add IMID support. (#7982)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoya-takei authored Jan 28, 2022
1 parent 31e9866 commit 476c0eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/yieldoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export const spec = {
payload.lr_env = idlEnv;
}

// IMID
const imuid = deepAccess(bidRequest, 'userId.imuid');
if (isStr(imuid) && !isEmpty(imuid)) {
payload.imuid = imuid;
}

return {
method: 'GET',
url: ENDPOINT_URL,
Expand Down
33 changes: 33 additions & 0 deletions test/spec/modules/yieldoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,39 @@ describe('yieldoneBidAdapter', function() {
expect(request[0].data.lr_env).to.equal('idl_env_sample');
});
});

describe('IMID', function () {
it('dont send IMID if undefined', function () {
const bidRequests = [
{
params: {placementId: '0'},
},
{
params: {placementId: '1'},
userId: {},
},
{
params: {placementId: '2'},
userId: undefined,
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request[0].data).to.not.have.property('imuid');
expect(request[1].data).to.not.have.property('imuid');
expect(request[2].data).to.not.have.property('imuid');
});

it('should send IMID if available', function () {
const bidRequests = [
{
params: {placementId: '0'},
userId: {imuid: 'imuid_sample'},
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request[0].data.imuid).to.equal('imuid_sample');
});
});
});

describe('interpretResponse', function () {
Expand Down

0 comments on commit 476c0eb

Please sign in to comment.