From 8654ce32ea2238d07d65c5ed1da733adede42b55 Mon Sep 17 00:00:00 2001 From: jwier Date: Tue, 22 Mar 2022 11:05:15 -0700 Subject: [PATCH] add support for the schain option to the conversant adapter --- modules/conversantBidAdapter.js | 6 ++++++ test/spec/modules/conversantBidAdapter_spec.js | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/modules/conversantBidAdapter.js b/modules/conversantBidAdapter.js index f631ca2af3d..7ee8b1b7681 100644 --- a/modules/conversantBidAdapter.js +++ b/modules/conversantBidAdapter.js @@ -136,6 +136,12 @@ export const spec = { let userExt = {}; + // pass schain object if it is present + const schain = deepAccess(validBidRequests, '0.schain'); + if (schain) { + deepSetValue(payload, 'source.ext.schain', schain); + } + if (bidderRequest) { // Add GDPR flag and consent string if (bidderRequest.gdprConsent) { diff --git a/test/spec/modules/conversantBidAdapter_spec.js b/test/spec/modules/conversantBidAdapter_spec.js index bc5cbd4134b..53169326d3b 100644 --- a/test/spec/modules/conversantBidAdapter_spec.js +++ b/test/spec/modules/conversantBidAdapter_spec.js @@ -3,6 +3,7 @@ import {spec, storage} from 'modules/conversantBidAdapter.js'; import * as utils from 'src/utils.js'; import {createEidsArray} from 'modules/userId/eids.js'; import { config } from '../../../src/config.js'; +import {deepAccess} from 'src/utils'; describe('Conversant adapter tests', function() { const siteId = '108060'; @@ -373,6 +374,20 @@ describe('Conversant adapter tests', function() { config.resetConfig(); }); + it('Verify supply chain data', () => { + const bidderRequest = {refererInfo: {referer: 'http://test.com?a=b&c=123'}}; + const schain = {complete: 1, ver: '1.0', nodes: [{asi: 'bidderA.com', sid: '00001', hp: 1}]}; + const bidsWithSchain = bidRequests.map((bid) => { + return Object.assign({ + schain: schain + }, bid); + }); + const request = spec.buildRequests(bidsWithSchain, bidderRequest); + const payload = request.data; + expect(deepAccess(payload, 'source.ext.schain.nodes')).to.exist; + expect(payload.source.ext.schain.nodes[0].asi).equals(schain.nodes[0].asi); + }); + it('Verify override url', function() { const testUrl = 'https://someurl?name=value'; const request = spec.buildRequests([{params: {white_label_url: testUrl}}]);