Skip to content

Commit

Permalink
add support for the schain option to the conversant adapter (#8203)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwier authored Mar 23, 2022
1 parent fdbbec9 commit dce0ac5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/conversantBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}}]);
Expand Down

0 comments on commit dce0ac5

Please sign in to comment.