From 7978d89af456a06b74810031404d113db247c785 Mon Sep 17 00:00:00 2001 From: Marsel Taipov Date: Mon, 24 Jan 2022 14:39:04 +0300 Subject: [PATCH 1/2] avoid sending zero bid floor if it is not defined --- modules/kubientBidAdapter.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index fd776793d91..a0b1a54d902 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -24,22 +24,20 @@ export const spec = { return; } return validBidRequests.map(function (bid) { - let floor = 0.0; + let adSlot = { + bidId: bid.bidId, + zoneId: bid.params.zoneid || '' + }; + if (typeof bid.getFloor === 'function') { const mediaType = (Object.keys(bid.mediaTypes).length == 1) ? Object.keys(bid.mediaTypes)[0] : '*'; const sizes = bid.sizes || '*'; const floorInfo = bid.getFloor({currency: 'USD', mediaType: mediaType, size: sizes}); if (typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) { - floor = parseFloat(floorInfo.floor); + adSlot.floor = parseFloat(floorInfo.floor); } } - let adSlot = { - bidId: bid.bidId, - zoneId: bid.params.zoneid || '', - floor: floor || 0.0 - }; - if (bid.mediaTypes.banner) { adSlot.banner = bid.mediaTypes.banner; } From 38b8fd7aa43b3995cf1f4a78c712436e887a714b Mon Sep 17 00:00:00 2001 From: Marsel Taipov Date: Thu, 3 Feb 2022 18:29:31 +0300 Subject: [PATCH 2/2] do not send 0 bidfloor --- modules/kubientBidAdapter.js | 7 +++++-- test/spec/modules/kubientBidAdapter_spec.js | 8 +++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index a0b1a54d902..46360572576 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -33,8 +33,11 @@ export const spec = { const mediaType = (Object.keys(bid.mediaTypes).length == 1) ? Object.keys(bid.mediaTypes)[0] : '*'; const sizes = bid.sizes || '*'; const floorInfo = bid.getFloor({currency: 'USD', mediaType: mediaType, size: sizes}); - if (typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) { - adSlot.floor = parseFloat(floorInfo.floor); + if (typeof floorInfo === 'object' && floorInfo.currency === 'USD') { + let floor = parseFloat(floorInfo.floor) + if (!isNaN(floor) && floor > 0) { + adSlot.floor = parseFloat(floorInfo.floor); + } } } diff --git a/test/spec/modules/kubientBidAdapter_spec.js b/test/spec/modules/kubientBidAdapter_spec.js index 2d3801450ba..f7afc709564 100644 --- a/test/spec/modules/kubientBidAdapter_spec.js +++ b/test/spec/modules/kubientBidAdapter_spec.js @@ -19,7 +19,7 @@ describe('KubientAdapter', function () { }, getFloor: function(params) { return { - floor: 0.05, + floor: 0, currency: 'USD' }; }, @@ -127,10 +127,9 @@ describe('KubientAdapter', function () { expect(data.uspConsent).to.exist.and.to.equal(uspConsentData); for (let j = 0; j < data['adSlots'].length; j++) { let adSlot = data['adSlots'][i]; - expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'floor', 'banner', 'schain'); + expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'banner', 'schain'); expect(adSlot.bidId).to.be.a('string').and.to.equal(bidBanner.bidId); expect(adSlot.zoneId).to.be.a('string').and.to.equal(bidBanner.params.zoneid); - expect(adSlot.floor).to.be.a('number'); expect(adSlot.schain).to.be.an('object'); expect(adSlot.banner).to.be.an('object'); } @@ -202,10 +201,9 @@ describe('KubientAdapter', function () { expect(data.uspConsent).to.exist.and.to.equal(uspConsentData); for (let j = 0; j < data['adSlots'].length; j++) { let adSlot = data['adSlots'][i]; - expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'floor', 'banner', 'schain'); + expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'banner', 'schain'); expect(adSlot.bidId).to.be.a('string').and.to.equal(bidBanner.bidId); expect(adSlot.zoneId).to.be.a('string').and.to.equal(bidBanner.params.zoneid); - expect(adSlot.floor).to.be.a('number'); expect(adSlot.schain).to.be.an('object'); expect(adSlot.banner).to.be.an('object'); }