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

Adyoulike Bid Adapter: fix eids retrieve #10102

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const spec = {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);
let hasVideo = false;
let eids;
const payload = {
Version: VERSION,
Bids: bidRequests.reduce((accumulator, bidReq) => {
Expand All @@ -81,6 +82,9 @@ export const spec = {
if (bidReq.schain) {
accumulator[bidReq.bidId].SChain = bidReq.schain;
}
if (!eids && bidReq.userIdAsEids && bidReq.userIdAsEids.length) {
eids = bidReq.userIdAsEids;
}
if (mediatype === NATIVE) {
let nativeReq = bidReq.mediaTypes.native;
if (nativeReq.type === 'image') {
Expand Down Expand Up @@ -120,9 +124,8 @@ export const spec = {
if (bidderRequest.ortb2) {
payload.ortb2 = bidderRequest.ortb2;
}

if (deepAccess(bidderRequest, 'userIdAsEids')) {
payload.userId = bidderRequest.userIdAsEids;
if (eids) {
payload.eids = eids;
}

payload.pbjs_version = '$prebid.version$';
Expand Down
37 changes: 13 additions & 24 deletions test/spec/modules/adyoulikeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,32 +707,21 @@ describe('Adyoulike Adapter', function () {
expect(payload.gdprConsent.consentRequired).to.be.null;
});

it('should add userid eids information to the request', function () {
let bidderRequest = {
'auctionId': '1d1a030790a475',
'bidderRequestId': '22edbae2733bf6',
'timeout': 3000,
'userIdAsEids':
[
{
'source': 'pubcid.org',
'uids': [
{
'atype': 1,
'id': '01EAJWWNEPN3CYMM5N8M5VXY22'
}
]
}
]
};

bidderRequest.bids = bidRequestWithSinglePlacement;

const request = spec.buildRequests(bidRequestWithSinglePlacement, bidderRequest);
it('should add eids eids information to the request', function () {
let bidRequest = bidRequestWithSinglePlacement;
bidRequest[0].userIdAsEids = [{
'source': 'pubcid.org',
'uids': [{
'atype': 1,
'id': '01EAJWWNEPN3CYMM5N8M5VXY22'
}]
}]

const request = spec.buildRequests(bidRequest, bidderRequest);
const payload = JSON.parse(request.data);

expect(payload.userId).to.exist;
expect(payload.userId).to.deep.equal(bidderRequest.userIdAsEids);
expect(payload.eids).to.exist;
expect(payload.eids).to.deep.equal(bidRequest[0].userIdAsEids);
});

it('sends bid request to endpoint with single placement', function () {
Expand Down