From 37eabf5a73693affdeda7d34d2a3f1a3e3d00936 Mon Sep 17 00:00:00 2001 From: yieldlift <61510052+yieldlift@users.noreply.github.com> Date: Mon, 25 Jul 2022 19:01:52 +0200 Subject: [PATCH] Yieldlift Bid Adapter: add support for eids (#8707) * Added eids parameter * Added eids parameter test * Fixing utils Co-authored-by: Danijel Predarski --- modules/yieldliftBidAdapter.js | 8 +++++++- test/spec/modules/yieldliftBidAdapter_spec.js | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/yieldliftBidAdapter.js b/modules/yieldliftBidAdapter.js index fddc9a0d50b..160d7e9a009 100644 --- a/modules/yieldliftBidAdapter.js +++ b/modules/yieldliftBidAdapter.js @@ -1,4 +1,4 @@ -import { deepSetValue, logInfo, deepAccess } from '../src/utils.js'; +import {deepSetValue, logInfo, deepAccess} from '../src/utils.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; import {BANNER} from '../src/mediaTypes.js'; @@ -72,6 +72,12 @@ export const spec = { deepSetValue(openrtbRequest, 'regs.ext.us_privacy', bidderRequest.uspConsent); } + // EIDS + const eids = deepAccess(validBidRequests[0], 'userIdAsEids'); + if (Array.isArray(eids) && eids.length > 0) { + deepSetValue(openrtbRequest, 'user.ext.eids', eids); + } + const payloadString = JSON.stringify(openrtbRequest); return { method: 'POST', diff --git a/test/spec/modules/yieldliftBidAdapter_spec.js b/test/spec/modules/yieldliftBidAdapter_spec.js index abb5a868c77..c2379ed7778 100644 --- a/test/spec/modules/yieldliftBidAdapter_spec.js +++ b/test/spec/modules/yieldliftBidAdapter_spec.js @@ -191,6 +191,26 @@ describe('YieldLift', function () { expect(payload.user.ext).to.have.property('consent', req.gdprConsent.consentString); expect(payload.regs.ext).to.have.property('gdpr', 1); }); + + it('should properly forward eids parameters', function () { + const req = Object.assign({}, REQUEST); + req.bidRequest[0].userIdAsEids = [ + { + source: 'dummy.com', + uids: [ + { + id: 'd6d0a86c-20c6-4410-a47b-5cba383a698a', + atype: 1 + } + ] + }]; + let request = spec.buildRequests(req.bidRequest, req); + + const payload = JSON.parse(request.data); + expect(payload.user.ext.eids[0].source).to.equal('dummy.com'); + expect(payload.user.ext.eids[0].uids[0].id).to.equal('d6d0a86c-20c6-4410-a47b-5cba383a698a'); + expect(payload.user.ext.eids[0].uids[0].atype).to.equal(1); + }); }); describe('interpretResponse', function () {