Skip to content

Commit

Permalink
Prebid.js 7: update pbsBidAdapter to use imp.ext.prebid.bidder.BIDDER (
Browse files Browse the repository at this point in the history
…#8513)

* .prebid.bidder

* add other paths

* revert

* remove added path

* deepSetValue template string

* add back accidentally deleted line
  • Loading branch information
ChrisHuie authored Jun 6, 2022
1 parent 5905aa9 commit 759cfc0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 4 additions & 1 deletion modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,10 @@ Object.assign(ORTB2.prototype, {
if (adapter && adapter.getSpec().transformBidParams) {
bid.params = adapter.getSpec().transformBidParams(bid.params, true, adUnit, bidRequests);
}
acc[bid.bidder] = (s2sConfig.adapterOptions && s2sConfig.adapterOptions[bid.bidder]) ? Object.assign({}, bid.params, s2sConfig.adapterOptions[bid.bidder]) : bid.params;
deepSetValue(acc,
`prebid.bidder.${bid.bidder}`,
(s2sConfig.adapterOptions && s2sConfig.adapterOptions[bid.bidder]) ? Object.assign({}, bid.params, s2sConfig.adapterOptions[bid.bidder]) : bid.params
);
return acc;
}, {...deepAccess(adUnit, 'ortb2Imp.ext')});

Expand Down
16 changes: 9 additions & 7 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1502,11 +1502,12 @@ describe('S2S Adapter', function () {
adapter.callBids(myRequest, BID_REQUESTS, addBidResponse, done, ajax);
const requestBid = JSON.parse(server.requests[0].requestBody);

expect(requestBid.imp[0].ext.appnexus).to.exist;
expect(requestBid.imp[0].ext.appnexus.placement_id).to.exist.and.to.equal(10433394);
expect(requestBid.imp[0].ext.appnexus.use_pmt_rule).to.exist.and.to.be.true;
expect(requestBid.imp[0].ext.appnexus.member).to.exist;
expect(requestBid.imp[0].ext.appnexus.keywords).to.exist.and.to.deep.equal([{
const requestParams = requestBid.imp[0].ext.prebid.bidder;
expect(requestParams.appnexus).to.exist;
expect(requestParams.appnexus.placement_id).to.exist.and.to.equal(10433394);
expect(requestParams.appnexus.use_pmt_rule).to.exist.and.to.be.true;
expect(requestParams.appnexus.member).to.exist;
expect(requestParams.appnexus.keywords).to.exist.and.to.deep.equal([{
key: 'foo',
value: ['bar', 'baz']
}, {
Expand Down Expand Up @@ -1586,8 +1587,9 @@ describe('S2S Adapter', function () {
config.setConfig(_config);
adapter.callBids(s2sBidRequest, BID_REQUESTS, addBidResponse, done, ajax);
const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.imp[0].ext.appnexus).to.haveOwnProperty('key');
expect(requestBid.imp[0].ext.appnexus.key).to.be.equal('value')
const requestParams = requestBid.imp[0].ext.prebid.bidder;
expect(requestParams.appnexus).to.haveOwnProperty('key');
expect(requestParams.appnexus.key).to.be.equal('value')
});

describe('config site value is added to the oRTB request', function () {
Expand Down

0 comments on commit 759cfc0

Please sign in to comment.