Skip to content

Commit

Permalink
Send experian rtid in the bid request payload (#10961)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonGoSonobi authored Jan 18, 2024
1 parent a7e6ce9 commit f95f520
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Renderer } from '../src/Renderer.js';
import { userSync } from '../src/userSync.js';
import { bidderSettings } from '../src/bidderSettings.js';
import { getAllOrtbKeywords } from '../libraries/keywords/keywords.js';
import {getGptSlotInfoForAdUnitCode} from '../libraries/gptUtils/gptUtils.js';
import { getGptSlotInfoForAdUnitCode } from '../libraries/gptUtils/gptUtils.js';
const BIDDER_CODE = 'sonobi';
const STR_ENDPOINT = 'https://apex.go.sonobi.com/trinity.json';
const PAGEVIEW_ID = generateUUID();
Expand Down Expand Up @@ -150,6 +150,11 @@ export const spec = {
payload.coppa = 0;
}

if (deepAccess(bidderRequest, 'ortb2.experianRtidData') && deepAccess(bidderRequest, 'ortb2.experianRtidKey')) {
payload.expData = deepAccess(bidderRequest, 'ortb2.experianRtidData');
payload.expKey = deepAccess(bidderRequest, 'ortb2.experianRtidKey');
}

// If there is no key_maker data, then don't make the request.
if (isEmpty(data)) {
return null;
Expand Down
22 changes: 16 additions & 6 deletions test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {expect} from 'chai';
import {_getPlatform, spec} from 'modules/sonobiBidAdapter.js';
import {newBidder} from 'src/adapters/bidderFactory.js';
import {userSync} from '../../../src/userSync.js';
import {config} from 'src/config.js';
import { expect } from 'chai';
import { _getPlatform, spec } from 'modules/sonobiBidAdapter.js';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { userSync } from '../../../src/userSync.js';
import { config } from 'src/config.js';
import * as gptUtils from '../../../libraries/gptUtils/gptUtils.js';

describe('SonobiBidAdapter', function () {
Expand Down Expand Up @@ -359,7 +359,9 @@ describe('SonobiBidAdapter', function () {
'page': 'https://example.com',
'stack': ['https://example.com']
},
uspConsent: 'someCCPAString'
uspConsent: 'someCCPAString',
ortb2: {}

};

it('should set fpd if there is any data in ortb2', function () {
Expand Down Expand Up @@ -493,6 +495,14 @@ describe('SonobiBidAdapter', function () {
expect(bidRequests.data.hfa).to.equal('hfakey')
})

it('should return a properly formatted request with expData and expKey', function () {
bidderRequests.ortb2.experianRtidData = 'IkhlbGxvLCB3b3JsZC4gSGVsbG8sIHdvcmxkLiBIZWxsbywgd29ybGQuIg==';
bidderRequests.ortb2.experianRtidKey = 'sovrn-encryption-key-1';
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.data.expData).to.equal('IkhlbGxvLCB3b3JsZC4gSGVsbG8sIHdvcmxkLiBIZWxsbywgd29ybGQuIg==');
expect(bidRequests.data.expKey).to.equal('sovrn-encryption-key-1');
})

it('should return null if there is nothing to bid on', function () {
const bidRequests = spec.buildRequests([{ params: {} }], bidderRequests)
expect(bidRequests).to.equal(null);
Expand Down

0 comments on commit f95f520

Please sign in to comment.