From 38eb15368f1777bab8ad123bae33edd51fc92649 Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Wed, 15 May 2024 12:31:15 -0700 Subject: [PATCH] Prebid 9: stop using transformBidParams --- libraries/pbsExtensions/processors/params.js | 12 +--- .../modules/prebidServerBidAdapter_spec.js | 33 ----------- .../pbsExtensions/params_spec.js | 58 ------------------- 3 files changed, 1 insertion(+), 102 deletions(-) diff --git a/libraries/pbsExtensions/processors/params.js b/libraries/pbsExtensions/processors/params.js index 010ffa5b372..dbfbb928953 100644 --- a/libraries/pbsExtensions/processors/params.js +++ b/libraries/pbsExtensions/processors/params.js @@ -1,17 +1,7 @@ -import {auctionManager} from '../../../src/auctionManager.js'; -import adapterManager from '../../../src/adapterManager.js'; import {deepSetValue} from '../../../src/utils.js'; -export function setImpBidParams( - imp, bidRequest, context, - {adUnit, bidderRequests, index = auctionManager.index, bidderRegistry = adapterManager.bidderRegistry} = {}) { +export function setImpBidParams(imp, bidRequest) { let params = bidRequest.params; - const adapter = bidderRegistry[bidRequest.bidder]; - if (adapter && adapter.getSpec().transformBidParams) { - adUnit = adUnit || index.getAdUnit(bidRequest); - bidderRequests = bidderRequests || [context.bidderRequest]; - params = adapter.getSpec().transformBidParams(params, true, adUnit, bidderRequests); - } if (params) { deepSetValue( imp, diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js index 9c2ac8a23a9..90014a28177 100644 --- a/test/spec/modules/prebidServerBidAdapter_spec.js +++ b/test/spec/modules/prebidServerBidAdapter_spec.js @@ -1726,39 +1726,6 @@ describe('S2S Adapter', function () { }); }); - it('converts appnexus params to expected format for PBS', function () { - const s2sConfig = Object.assign({}, CONFIG, { - endpoint: { - p1Consent: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' - } - }); - config.setConfig({ s2sConfig: s2sConfig }); - - Object.assign(BID_REQUESTS[0].bids[0].params, { - usePaymentRule: true, - keywords: { - foo: ['bar', 'baz'], - fizz: ['buzz'] - } - }) - - adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax); - const requestBid = JSON.parse(server.requests[0].requestBody); - - 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'] - }, { - key: 'fizz', - value: ['buzz'] - }]); - }); - describe('cookie sync', () => { let s2sConfig, bidderReqs; diff --git a/test/spec/ortbConverter/pbsExtensions/params_spec.js b/test/spec/ortbConverter/pbsExtensions/params_spec.js index 73b92a0755d..d1b36c18b49 100644 --- a/test/spec/ortbConverter/pbsExtensions/params_spec.js +++ b/test/spec/ortbConverter/pbsExtensions/params_spec.js @@ -34,63 +34,5 @@ describe('pbjs -> ortb bid params to imp[].ext.prebid.BIDDER', () => { it('has no effect if bidRequest has no params', () => { expect(setParams({bidder: 'mockBidder'})).to.eql({}); - }) - - describe('when adapter provides transformBidParams', () => { - let transform, bidderRequest; - beforeEach(() => { - bidderRequest = {bidderCode: 'mockBidder'}; - transform = sinon.stub().callsFake((p) => Object.assign({transformed: true}, p)); - bidderRegistry.mockBidder = { - getSpec() { - return { - transformBidParams: transform - } - } - } - }) - - it('runs params through transform', () => { - expect(setParams({bidder: 'mockBidder', params: {a: 'param'}}, {bidderRequest})).to.eql({ - ext: { - prebid: { - bidder: { - mockBidder: { - a: 'param', - transformed: true - } - } - } - } - }); - }); - - it('runs through transform even if bid has no params', () => { - expect(setParams({bidder: 'mockBidder'}, {bidderRequest})).to.eql({ - ext: { - prebid: { - bidder: { - mockBidder: { - transformed: true - } - } - } - } - }) - }) - - it('by default, passes adUnit from index, bidderRequest from context', () => { - const params = {a: 'param'}; - setParams({bidder: 'mockBidder', params}, {bidderRequest}); - sinon.assert.calledWith(transform, params, true, adUnit, [bidderRequest]) - }); - - it('uses provided adUnit, bidderRequests', () => { - const adUnit = {code: 'other-ad-unit'}; - const bidderRequests = [{bidderCode: 'one'}, {bidderCode: 'two'}]; - const params = {a: 'param'}; - setParams({bidder: 'mockBidder', params}, {}, {adUnit, bidderRequests}); - sinon.assert.calledWith(transform, params, true, adUnit, bidderRequests); - }) }); });