diff --git a/src/adapters/aol.js b/src/adapters/aol.js index f02e58366a8..52ed6bd9212 100644 --- a/src/adapters/aol.js +++ b/src/adapters/aol.js @@ -5,6 +5,7 @@ const bidmanager = require('../bidmanager.js'); const AolAdapter = function AolAdapter() { + let showCpmAdjustmentWarning = true; const pubapiTemplate = template`${'protocol'}://${'host'}/pubapi/3.0/${'network'}/${'placement'}/${'pageid'}/${'sizeid'}/ADTECH;v=2;cmd=bid;cors=yes;alias=${'alias'}${'bidfloor'};misc=${'misc'}`; const BIDDER_CODE = 'aol'; const SERVER_MAP = { @@ -117,6 +118,19 @@ const AolAdapter = function AolAdapter() { const pubapiUrl = _buildPubapiUrl(bid); ajax(pubapiUrl, response => { + // needs to be here in case bidderSettings are defined after requestBids() is called + if (showCpmAdjustmentWarning && + $$PREBID_GLOBAL$$.bidderSettings && $$PREBID_GLOBAL$$.bidderSettings.aol && + typeof $$PREBID_GLOBAL$$.bidderSettings.aol.bidCpmAdjustment === 'function' && + console && console.warn + ) { + console.warn( + 'WARNING: bidCpmAdjustment is active for the AOL adapter. ' + + 'As of Prebid 0.14, AOL can bid in net – please contact your accounts team to enable.' + ); + } + showCpmAdjustmentWarning = false; // warning is shown at most once + if (!response && response.length <= 0) { utils.logError('Empty bid response', BIDDER_CODE, bid); _addErrorBidResponse(bid, response); diff --git a/test/spec/adapters/aol_spec.js b/test/spec/adapters/aol_spec.js index 8eb09af4496..d00b9fb98d2 100644 --- a/test/spec/adapters/aol_spec.js +++ b/test/spec/adapters/aol_spec.js @@ -430,5 +430,36 @@ describe('AolAdapter', () => { expect(bidResponse.cpm).to.equal('a9334987'); }); }); + + describe('when bidCpmAdjustment is set', () => { + let bidderSettingsBackup; + let server; + + beforeEach(() => { + bidderSettingsBackup = $$PREBID_GLOBAL$$.bidderSettings; + server = sinon.fakeServer.create(); + }); + + afterEach(() => { + $$PREBID_GLOBAL$$.bidderSettings = bidderSettingsBackup; + server.restore(); + if (console.warn.restore) { + console.warn.restore(); + } + }); + + it('should show warning in the console', function() { + sinon.spy(console, 'warn'); + server.respondWith(JSON.stringify(DEFAULT_PUBAPI_RESPONSE)); + $$PREBID_GLOBAL$$.bidderSettings = { + aol: { + bidCpmAdjustment: function() {} + } + }; + adapter.callBids(DEFAULT_BIDDER_REQUEST); + server.respond(); + expect(console.warn.calledOnce).to.be.true; + }); + }); }); });