From 95c8118583eb0737409e41c8f436f90bc134df32 Mon Sep 17 00:00:00 2001 From: OctaviaS20 <151752110+OctaviaS20@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:12:56 +0300 Subject: [PATCH] Connatix Bid Adapter : support eids (#12142) * add eids on request * change naming --------- Co-authored-by: Darian Avasan Co-authored-by: Octavia Suceava --- modules/connatixBidAdapter.js | 15 ++++++++- test/spec/modules/connatixBidAdapter_spec.js | 32 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/modules/connatixBidAdapter.js b/modules/connatixBidAdapter.js index de0bddc3b97..925ddebe099 100644 --- a/modules/connatixBidAdapter.js +++ b/modules/connatixBidAdapter.js @@ -7,7 +7,8 @@ import { isFn, logError, isArray, - formatQS + formatQS, + deepSetValue } from '../src/utils.js'; import { @@ -61,6 +62,16 @@ export function validateVideo(mediaTypes) { return video.context !== ADPOD; } +/** + * Get ids from Prebid User ID Modules and add them to the payload + */ +function _handleEids(payload, validBidRequests) { + let bidUserIdAsEids = deepAccess(validBidRequests, '0.userIdAsEids'); + if (isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) { + deepSetValue(payload, 'userIdList', bidUserIdAsEids); + } +} + export const spec = { code: BIDDER_CODE, gvlid: 143, @@ -127,6 +138,8 @@ export const spec = { bidRequests, }; + _handleEids(requestPayload, validBidRequests); + return { method: 'POST', url: AD_URL, diff --git a/test/spec/modules/connatixBidAdapter_spec.js b/test/spec/modules/connatixBidAdapter_spec.js index ceb91a46bee..d2e8ea63cbe 100644 --- a/test/spec/modules/connatixBidAdapter_spec.js +++ b/test/spec/modules/connatixBidAdapter_spec.js @@ -352,6 +352,38 @@ describe('connatixBidAdapter', function () { }); }); + describe('userIdAsEids', function() { + let validBidRequests; + + this.beforeEach(function () { + bid = mockBidRequest(); + validBidRequests = [bid]; + }) + + it('Connatix adapter reads EIDs from Prebid user models and adds it to Request', function() { + validBidRequests[0].userIdAsEids = [{ + 'source': 'adserver.org', + 'uids': [{ + 'id': 'TTD_ID_FROM_USER_ID_MODULE', + 'atype': 1, + 'ext': { + 'stype': 'ppuid', + 'rtiPartner': 'TDID' + } + }] + }, + { + 'source': 'pubserver.org', + 'uids': [{ + 'id': 'TDID_FROM_USER_ID_MODULE', + 'atype': 1 + }] + }]; + let serverRequest = spec.buildRequests(validBidRequests, {}); + expect(serverRequest.data.userIdList).to.deep.equal(validBidRequests[0].userIdAsEids); + }); + }); + describe('getBidFloor', function () { this.beforeEach(function () { bid = mockBidRequest();