From e45aa2fe631bd32c9a44a7cbe720157c8c1934ff Mon Sep 17 00:00:00 2001 From: Daria Boyko Date: Tue, 2 Jul 2024 18:13:25 +0300 Subject: [PATCH] Admixer Bid Adapter: change admixerwl to rtbstack alias (#11905) * Update README.md update * Add admixerwl alias for admixerBidAdapter. * add rtbstack alias to admixerBidAdapter * rtbstack tests * RTB Stack Test Parameters --------- Co-authored-by: AdmixerTech <35560933+AdmixerTech@users.noreply.github.com> Co-authored-by: AdmixerTech Co-authored-by: Yaroslav Masenko Co-authored-by: Daria Boyko --- modules/admixerBidAdapter.js | 16 ++++++---- modules/admixerBidAdapter.md | 17 +++++------ test/spec/modules/admixerBidAdapter_spec.js | 34 ++++++++++++--------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/modules/admixerBidAdapter.js b/modules/admixerBidAdapter.js index de7b941d6146..5cf3cc44cdd7 100644 --- a/modules/admixerBidAdapter.js +++ b/modules/admixerBidAdapter.js @@ -13,7 +13,7 @@ const ALIASES = [ {code: 'futureads', endpoint: 'https://ads.futureads.io/prebid.1.2.aspx'}, {code: 'smn', endpoint: 'https://ads.smn.rs/prebid.1.2.aspx'}, {code: 'admixeradx', endpoint: 'https://inv-nets.admixer.net/adxprebid.1.2.aspx'}, - {code: 'admixerwl', endpoint: 'https://inv-nets-adxwl.admixer.com/adxwlprebid.aspx'}, + 'rtbstack' ]; export const spec = { code: BIDDER_CODE, @@ -23,8 +23,8 @@ export const spec = { * Determines whether or not the given bid request is valid. */ isBidRequestValid: function (bid) { - return bid.bidder === 'admixerwl' - ? !!bid.params.clientId && !!bid.params.endpointId + return bid.bidder === 'rtbstack' + ? !!bid.params.endpointId : !!bid.params.zone; }, /** @@ -51,8 +51,12 @@ export const spec = { }; let endpointUrl; if (bidderRequest) { - const {bidderCode} = bidderRequest; - endpointUrl = config.getConfig(`${bidderCode}.endpoint_url`); + // checks if there is specified any endpointUrl in bidder config + endpointUrl = config.getConfig('bidderURL'); + if (!endpointUrl && bidderRequest.bidderCode === 'rtbstack') { + logError('The bidderUrl config is required for RTB Stack bids. Please set it with setBidderConfig() for "rtbstack".'); + return; + } // TODO: is 'page' the right value here? if (bidderRequest.refererInfo?.page) { payload.referrer = encodeURIComponent(bidderRequest.refererInfo.page); @@ -82,7 +86,7 @@ export const spec = { let urlForRequest = endpointUrl || getEndpointUrl(bidderRequest.bidderCode) return { method: 'POST', - url: bidderRequest.bidderCode === 'admixerwl' ? `${urlForRequest}?client=${payload.imps[0]?.params?.clientId}` : urlForRequest, + url: urlForRequest, data: payload, }; }, diff --git a/modules/admixerBidAdapter.md b/modules/admixerBidAdapter.md index 64f8dd64ee4c..abaebfce065d 100644 --- a/modules/admixerBidAdapter.md +++ b/modules/admixerBidAdapter.md @@ -51,7 +51,7 @@ Please use ```admixer``` as the bidder code. ]; ``` -### AdmixerWL Test Parameters +### RTB Stack Test Parameters ``` var adUnits = [ { @@ -59,10 +59,9 @@ Please use ```admixer``` as the bidder code. sizes: [[300, 250]], // a display size bids: [ { - bidder: "admixer", + bidder: "rtbstack", params: { - endpointId: 41512, - clientId: 62 + endpointId: 41512 } } ] @@ -71,10 +70,9 @@ Please use ```admixer``` as the bidder code. sizes: [[300, 50]], // a mobile size bids: [ { - bidder: "admixer", + bidder: "rtbstack", params: { - endpointId: 41512, - clientId: 62 + endpointId: 41512 } } ] @@ -84,10 +82,9 @@ Please use ```admixer``` as the bidder code. mediaType: 'video', bids: [ { - bidder: "admixer", + bidder: "rtbstack", params: { - endpointId: 41512, - clientId: 62 + endpointId: 41512 } } ] diff --git a/test/spec/modules/admixerBidAdapter_spec.js b/test/spec/modules/admixerBidAdapter_spec.js index 4b70f0cec00d..cf9398c61195 100644 --- a/test/spec/modules/admixerBidAdapter_spec.js +++ b/test/spec/modules/admixerBidAdapter_spec.js @@ -4,7 +4,7 @@ import {newBidder} from 'src/adapters/bidderFactory.js'; import {config} from '../../../src/config.js'; const BIDDER_CODE = 'admixer'; -const WL_BIDDER_CODE = 'admixerwl' +const RTB_BIDDER_CODE = 'rtbstack' const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.2.aspx'; const ENDPOINT_URL_CUSTOM = 'https://custom.admixer.net/prebid.aspx'; const ZONE_ID = '2eb6bd58-865c-47ce-af7f-a918108c3fd2'; @@ -37,10 +37,9 @@ describe('AdmixerAdapter', function () { auctionId: '1d1a030790a475', }; - let wlBid = { - bidder: WL_BIDDER_CODE, + let rtbBid = { + bidder: RTB_BIDDER_CODE, params: { - clientId: CLIENT_ID, endpointId: ENDPOINT_ID, }, adUnitCode: 'adunit-code', @@ -56,8 +55,8 @@ describe('AdmixerAdapter', function () { it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when params required by WL found', function () { - expect(spec.isBidRequestValid(wlBid)).to.equal(true); + it('should return true when params required by RTB found', function () { + expect(spec.isBidRequestValid(rtbBid)).to.equal(true); }); it('should return false when required params are not passed', function () { @@ -68,8 +67,8 @@ describe('AdmixerAdapter', function () { }; expect(spec.isBidRequestValid(invalidBid)).to.equal(false); }); - it('should return false when params required by WL are not passed', function () { - let invalidBid = Object.assign({}, wlBid); + it('should return false when params required by RTB are not passed', function () { + let invalidBid = Object.assign({}, rtbBid); delete invalidBid.params; invalidBid.params = { clientId: 0, @@ -118,7 +117,7 @@ describe('AdmixerAdapter', function () { it('sends bid request to CUSTOM_ENDPOINT via GET', function () { config.setBidderConfig({ bidders: [BIDDER_CODE], // one or more bidders - config: { [BIDDER_CODE]: { endpoint_url: ENDPOINT_URL_CUSTOM } }, + config: { bidderURL: ENDPOINT_URL_CUSTOM }, }); const request = config.runWithBidder(BIDDER_CODE, () => spec.buildRequests(validRequest, bidderRequest) @@ -133,8 +132,7 @@ describe('AdmixerAdapter', function () { validRequest: [ { bidder: bidder, - params: bidder === 'admixerwl' ? { - clientId: CLIENT_ID, + params: bidder === 'rtbstack' ? { endpointId: ENDPOINT_ID } : { zone: ZONE_ID, @@ -193,10 +191,16 @@ describe('AdmixerAdapter', function () { expect(request.url).to.equal('https://inv-nets.admixer.net/adxprebid.1.2.aspx'); expect(request.method).to.equal('POST'); }); - it('build request for admixerwl', function () { - const requestParams = requestParamsFor('admixerwl'); - const request = spec.buildRequests(requestParams.validRequest, requestParams.bidderRequest); - expect(request.url).to.equal(`https://inv-nets-adxwl.admixer.com/adxwlprebid.aspx?client=${CLIENT_ID}`); + it('build request for rtbstack', function () { + const requestParams = requestParamsFor('rtbstack'); + config.setBidderConfig({ + bidders: ['rtbstack'], + config: { bidderURL: ENDPOINT_URL_CUSTOM }, + }); + const request = config.runWithBidder(BIDDER_CODE, () => + spec.buildRequests(requestParams.validRequest, requestParams.bidderRequest) + ); + expect(request.url).to.equal(ENDPOINT_URL_CUSTOM); expect(request.method).to.equal('POST'); }); });