diff --git a/modules/aolBidAdapter.js b/modules/aolBidAdapter.js index c899da32340..865fa2f0a17 100644 --- a/modules/aolBidAdapter.js +++ b/modules/aolBidAdapter.js @@ -120,6 +120,23 @@ function getSupportedEids(bid) { }); } +function getBidFloor(bid) { + if (!utils.isFn(bid.getFloor)) { + return (bid.params.bidFloor) ? bid.params.bidFloor : null; + } + + let floor = bid.getFloor({ + currency: 'USD', + mediaType: '*', + size: '*' + }); + + if (utils.isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'USD') { + return floor.floor; + } + return null; +} + export const spec = { code: AOL_BIDDERS_CODES.AOL, gvlid: 25, @@ -214,6 +231,7 @@ export const spec = { const params = bid.params; const serverParam = params.server; let regionParam = params.region || 'us'; + let bidFloor = getBidFloor(bid); let server; if (!MP_SERVER_MAP.hasOwnProperty(regionParam)) { @@ -238,7 +256,7 @@ export const spec = { sizeid: params.sizeId || 0, alias: params.alias || utils.getUniqueIdentifierStr(), misc: new Date().getTime(), // cache busting - dynamicParams: this.formatMarketplaceDynamicParams(params, consentData) + dynamicParams: this.formatMarketplaceDynamicParams(params, consentData, bidFloor) })); }, buildOneMobileGetUrl(bid, consentData) { @@ -268,11 +286,11 @@ export const spec = { } return (url.indexOf('//') === 0) ? `${DEFAULT_PROTO}:${url}` : `${DEFAULT_PROTO}://${url}`; }, - formatMarketplaceDynamicParams(params = {}, consentData = {}) { + formatMarketplaceDynamicParams(params = {}, consentData = {}, bidFloor = {}) { let queryParams = {}; - if (params.bidFloor) { - queryParams.bidfloor = params.bidFloor; + if (bidFloor) { + queryParams.bidfloor = bidFloor; } Object.assign(queryParams, this.formatKeyValues(params.keyValues)); diff --git a/test/spec/modules/aolBidAdapter_spec.js b/test/spec/modules/aolBidAdapter_spec.js index 8e74e19f420..8317c4997de 100644 --- a/test/spec/modules/aolBidAdapter_spec.js +++ b/test/spec/modules/aolBidAdapter_spec.js @@ -378,6 +378,20 @@ describe('AolAdapter', function () { expect(request.url).to.contain('bidfloor=0.8'); }); + it('should return url with bidFloor option from floor module if it is present', function () { + let getFloorResponse = { currency: 'USD', floor: 3 }; + let bidRequest = createCustomBidRequest({ + params: { + placement: 1234567, + network: '9599.1', + bidFloor: 0.80 + } + }); + bidRequest.getFloor = () => getFloorResponse; + let [request] = spec.buildRequests(bidRequest.bids); + expect(request.url).to.contain('bidfloor=3'); + }); + it('should return url with key values if keyValues param is present', function () { let bidRequest = createCustomBidRequest({ params: {