From 7660df73d37cfe813dfa6489c2afd9d85764c456 Mon Sep 17 00:00:00 2001 From: Sasan Farrokh Date: Mon, 24 Jan 2022 23:41:06 +0330 Subject: [PATCH 1/4] feat: add schain and bidfloor to vidoomy adapter --- modules/vidoomyBidAdapter.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/vidoomyBidAdapter.js b/modules/vidoomyBidAdapter.js index 64145b2c6b4..6476c51f955 100644 --- a/modules/vidoomyBidAdapter.js +++ b/modules/vidoomyBidAdapter.js @@ -77,6 +77,7 @@ const buildRequests = (validBidRequests, bidderRequest) => { const hostname = aElement.hostname const videoContext = deepAccess(bid, 'mediaTypes.video.context'); + const bidfloor = deepAccess(bid, `params.bidfloor`, 0); const queryParams = { id: bid.params.id, @@ -90,6 +91,8 @@ const buildRequests = (validBidRequests, bidderRequest) => { dt: /Mobi/.test(navigator.userAgent) ? 2 : 1, pid: bid.params.pid, requestId: bid.bidId, + schain: bid.schain || '', + bidfloor, d: getDomainWithoutSubdomain(hostname), // 'vidoomy.com', sp: encodeURIComponent(aElement.href), usp: bidderRequest.uspConsent || '', From f33223a4ed5f53afbf6e92f3d54098ec1345eee7 Mon Sep 17 00:00:00 2001 From: Sasan Farrokh Date: Mon, 24 Jan 2022 23:44:00 +0330 Subject: [PATCH 2/4] doc: update vidoomy docs --- modules/vidoomyBidAdapter.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/vidoomyBidAdapter.md b/modules/vidoomyBidAdapter.md index 11e0ad40dbb..f6c7f01ff13 100644 --- a/modules/vidoomyBidAdapter.md +++ b/modules/vidoomyBidAdapter.md @@ -26,7 +26,8 @@ var adUnits = [ bidder: 'vidoomy', params: { id: '123123', - pid: '123123' + pid: '123123', + bidfloor: 0.5 } } ] @@ -50,7 +51,8 @@ var adUnits = [ bidder: 'vidoomy', params: { id: '123123', - pid: '123123' + pid: '123123', + bidfloor: 0.5 } } ] From 01d8e959d772ac80eb6037376b3abebbf74a5acd Mon Sep 17 00:00:00 2001 From: Sasan Farrokh Date: Mon, 7 Feb 2022 10:22:56 +0330 Subject: [PATCH 3/4] fix: add bidfloor validation --- modules/vidoomyBidAdapter.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/vidoomyBidAdapter.js b/modules/vidoomyBidAdapter.js index 6476c51f955..d268f7a9d64 100644 --- a/modules/vidoomyBidAdapter.js +++ b/modules/vidoomyBidAdapter.js @@ -42,6 +42,11 @@ const isBidRequestValid = bid => { return false; } + if (bid.params.bidfloor && (isNaN(bid.params.bidfloor) || bid.params.bidfloor < 0)) { + logError(BIDDER_CODE + ': bid.params.bidfloor should be a number equal or greater than zero'); + return false; + } + return true; }; From f8a5f69fb2452853f3c6e15b30885e37739601f8 Mon Sep 17 00:00:00 2001 From: Sasan Farrokh Date: Mon, 7 Feb 2022 11:14:41 +0330 Subject: [PATCH 4/4] chore: update docs and tests --- modules/vidoomyBidAdapter.md | 4 ++-- test/spec/modules/vidoomyBidAdapter_spec.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/vidoomyBidAdapter.md b/modules/vidoomyBidAdapter.md index f6c7f01ff13..d91ace5a7b9 100644 --- a/modules/vidoomyBidAdapter.md +++ b/modules/vidoomyBidAdapter.md @@ -27,7 +27,7 @@ var adUnits = [ params: { id: '123123', pid: '123123', - bidfloor: 0.5 + bidfloor: 0.5 // This is optional } } ] @@ -52,7 +52,7 @@ var adUnits = [ params: { id: '123123', pid: '123123', - bidfloor: 0.5 + bidfloor: 0.5 // This is optional } } ] diff --git a/test/spec/modules/vidoomyBidAdapter_spec.js b/test/spec/modules/vidoomyBidAdapter_spec.js index 52f522bdcfc..8aa127faef2 100644 --- a/test/spec/modules/vidoomyBidAdapter_spec.js +++ b/test/spec/modules/vidoomyBidAdapter_spec.js @@ -16,7 +16,8 @@ describe('vidoomyBidAdapter', function() { 'bidder': 'vidoomy', 'params': { pid: '123123', - id: '123123' + id: '123123', + bidfloor: 0.5 }, 'adUnitCode': 'code', 'sizes': [[300, 250]] @@ -32,6 +33,11 @@ describe('vidoomyBidAdapter', function() { expect(spec.isBidRequestValid(bid)).to.equal(false); }); + it('should return false when bidfloor is invalid', function () { + bid.params.bidfloor = 'not a number'; + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); + it('should return false when id is empty', function () { bid.params.id = ''; expect(spec.isBidRequestValid(bid)).to.equal(false);