Skip to content

Commit

Permalink
Yieldmo Bid Adapter: Prevent Consent Override and Eids fix (#11734)
Browse files Browse the repository at this point in the history
* Prevent Consent Override

Bug fix where we do not override consent with eids.

* Eids fix

Adding eids to user.ext instead of user
  • Loading branch information
desidiver committed Jun 7, 2024
1 parent e94e081 commit 090863f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const spec = {
serverRequest.topics = topicsData;
}
if (eids.length) {
serverRequest.user = { eids };
deepSetValue(serverRequest, 'user.ext.eids', eids);
};
serverRequests.push({
method: 'POST',
Expand Down
47 changes: 45 additions & 2 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ describe('YieldmoAdapter', function () {
vendorData: {blerp: 1},
gdprApplies: true,
};
const data = buildAndGetData([mockBannerBid()], 0, mockBidderRequest({gdprConsent}));
const data = buildAndGetData(
[mockBannerBid()],
0,
mockBidderRequest({ gdprConsent })
);
expect(data.userConsent).equal(
JSON.stringify({
gdprApplies: true,
Expand Down Expand Up @@ -637,6 +641,45 @@ describe('YieldmoAdapter', function () {
expect(buildAndGetData([mockVideoBid({ortb2Imp})]).imp[0].ext.gpid).to.be.equal(ortb2Imp.ext.data.pbadslot);
});

it('should pass consent in video bid along with eids', () => {
const params = {
userIdAsEids: [
{
source: 'pubcid.org',
uids: [
{
id: 'fake_pubcid',
atype: 1,
},
],
},
],
fakeUserIdAsEids: [
{
source: 'pubcid.org',
uids: [
{
id: 'fake_pubcid',
atype: 1,
},
],
},
],
};
let videoBidder = mockBidderRequest(
{
gdprConsent: {
gdprApplies: 1,
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
},
},
[mockVideoBid()]
);
let payload = buildAndGetData([mockVideoBid({...params})], 0, videoBidder);
expect(payload.user.ext.consent).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==');
expect(payload.user.ext.eids).to.eql(params.fakeUserIdAsEids);
});

it('should add eids to the video bid request', function () {
const params = {
userIdAsEids: [{
Expand All @@ -656,7 +699,7 @@ describe('YieldmoAdapter', function () {
}]
}]
};
expect(buildAndGetData([mockVideoBid({...params})]).user.eids).to.eql(params.fakeUserIdAsEids);
expect(buildAndGetData([mockVideoBid({...params})]).user.ext.eids).to.eql(params.fakeUserIdAsEids);
});

it('should add topics to the bid request', function () {
Expand Down

0 comments on commit 090863f

Please sign in to comment.