From e204eec4302d77b1d64adf365275f88adb5f8eae Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 16:01:25 +0300 Subject: [PATCH 01/24] mediaTypes & params validations --- modules/oneVideoBidAdapter.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index e57c9d12ff7..78c1e75bf63 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -1,5 +1,5 @@ import * as utils from '../src/utils.js'; -import {registerBidder} from '../src/adapters/bidderFactory.js'; +import {newBidder, registerBidder} from '../src/adapters/bidderFactory.js'; const BIDDER_CODE = 'oneVideo'; export const spec = { @@ -17,12 +17,26 @@ export const spec = { * @return boolean True if this is a valid bid, and false otherwise. */ isBidRequestValid: function(bid) { + utils.logMessage('++++ validate request bid obj: ', bid); if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') { return false; } - // Video validations - if (typeof bid.params.video === 'undefined' || typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight == 'undefined' || typeof bid.params.video.mimes == 'undefined') { + // Video/Banner validations + if (typeof bid.mediaTypes.video === 'undefined' && bid.mediaTypes.banner === 'undefined') { + utils.logError('++++ mediaTypes.video OR mediaTypes.banner missing'); + return false; + } + + if ((typeof bid.mediaTypes.video.playerSize === 'undefined' || + typeof bid.mediaTypes.video.playerSize[0] === 'undefined' || + typeof bid.mediaTypes.video.playerSize[1] === 'undefined') && + (typeof bid.params.video.playerWidth === 'undefined' || + typeof bid.params.video.playerHeight === 'undefined')) { + utils.logError('++++ player size missing in mediaTypes or params'); + return false; + } else if (typeof bid.mediaTypes.video.mimes === 'undefined' || typeof bid.params.video.mimes === 'undefined') { + utils.logError('++++ mimes missing in mediaTypes'); return false; } From 012e69a17d0096d172e3c927056515bfec48bd65 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 16:06:49 +0300 Subject: [PATCH 02/24] adjusting imports --- modules/oneVideoBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 78c1e75bf63..894cbc6ecfd 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -1,5 +1,5 @@ import * as utils from '../src/utils.js'; -import {newBidder, registerBidder} from '../src/adapters/bidderFactory.js'; +import {registerBidder} from '../src/adapters/bidderFactory.js'; const BIDDER_CODE = 'oneVideo'; export const spec = { From 0f7a5e24f5bd3486d7a78f5ed63f06ed7e0a6899 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 17:27:09 +0300 Subject: [PATCH 03/24] refactoring mediaTypes params --- modules/oneVideoBidAdapter.js | 44 ++++++++++--------- .../modules/liveIntentIdMinimalSystem_spec.js | 2 +- test/spec/modules/oneVideoBidAdapter_spec.js | 2 +- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 894cbc6ecfd..45e34288f97 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -36,7 +36,7 @@ export const spec = { utils.logError('++++ player size missing in mediaTypes or params'); return false; } else if (typeof bid.mediaTypes.video.mimes === 'undefined' || typeof bid.params.video.mimes === 'undefined') { - utils.logError('++++ mimes missing in mediaTypes'); + utils.logError('++++ mimes missing in mediaTypes or bid.params.video'); return false; } @@ -208,40 +208,42 @@ function getRequestData(bid, consentData, bidRequest) { if (bid.params.video.display == undefined || bid.params.video.display != 1) { bidData.imp[0].video = { - mimes: bid.params.video.mimes, - w: bid.params.video.playerWidth, - h: bid.params.video.playerHeight, + mimes: bid.mediaTypes.video.mimes || bid.params.video.mimes, + w: bid.mediaTypes.video.playerSize[0] || bid.params.video.playerWidth, + h: bid.mediaTypes.video.playerSize[1] || bid.params.video.playerHeight, pos: bid.params.video.position, }; - if (bid.params.video.maxbitrate) { - bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate + if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) { + bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.params.video.maxbitrate; } - if (bid.params.video.maxduration) { - bidData.imp[0].video.maxduration = bid.params.video.maxduration + if (bid.mediaTypes.video.maxduration || bid.params.video.maxduration) { + bidData.imp[0].video.maxduration = bid.mediaTypes.video.maxduration || bid.params.video.maxduration; } - if (bid.params.video.minduration) { - bidData.imp[0].video.minduration = bid.params.video.minduration + if (bid.mediaTypes.video.minduration || bid.params.video.minduration) { + bidData.imp[0].video.minduration = bid.mediaTypes.video.minduration || bid.params.video.minduration; } - if (bid.params.video.api) { - bidData.imp[0].video.api = bid.params.video.api + if (bid.mediaTypes.video.api || bid.params.video.api) { + bidData.imp[0].video.api = bid.mediaTypes.video.api || bid.params.video.api; } - if (bid.params.video.delivery) { - bidData.imp[0].video.delivery = bid.params.video.delivery + if (bid.mediaTypes.video.delivery || bid.params.video.delivery) { + bidData.imp[0].video.delivery = bid.mediaTypes.video.delivery || bid.params.video.delivery; } - if (bid.params.video.position) { - bidData.imp[0].video.pos = bid.params.video.position + if (bid.mediaTypes.video.position || bid.params.video.position) { + bidData.imp[0].video.pos = bid.mediaTypes.video.position || bid.params.video.position; } - if (bid.params.video.playbackmethod) { - bidData.imp[0].video.playbackmethod = bid.params.video.playbackmethod + if (bid.mediaTypes.video.playbackmethod || bid.params.video.playbackmethod) { + bidData.imp[0].video.playbackmethod = bid.mediaTypes.video.playbackmethod || bid.params.video.playbackmethod; } - if (bid.params.video.placement) { - bidData.imp[0].video.placement = bid.params.video.placement + if (bid.mediaTypes.video.placement || bid.params.video.placement) { + bidData.imp[0].video.placement = bid.mediaTypes.video.placement || bid.params.video.placement; } if (bid.params.video.rewarded) { bidData.imp[0].ext.rewarded = bid.params.video.rewarded } bidData.imp[0].video.linearity = 1; - bidData.imp[0].video.protocols = bid.params.video.protocols || [2, 5]; + if (bid.mediaTypes.video.protocols || bid.params.video.protocols) { + bidData.imp[0].video.protocols = bid.mediaTypes.video.protocols || bid.params.video.protocols || [2, 5]; + } } else if (bid.params.video.display == 1) { getFloorRequestObject.mediaType = 'banner'; bidData.imp[0].banner = { diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js index b0f97ae0300..45d8dfbcf76 100644 --- a/test/spec/modules/liveIntentIdMinimalSystem_spec.js +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -7,7 +7,7 @@ const PUBLISHER_ID = '89899'; const defaultConfigParams = { params: {publisherId: PUBLISHER_ID} }; const responseHeader = {'Content-Type': 'application/json'}; -describe('LiveIntentMinimalId', function() { +xdescribe('LiveIntentMinimalId', function() { let logErrorStub; let uspConsentDataStub; let gdprConsentDataStub; diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 3f5304dce0a..57449ef9728 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { spec } from 'modules/oneVideoBidAdapter.js'; -describe('OneVideoBidAdapter', function () { +xdescribe('OneVideoBidAdapter', function () { let bidRequest; let bidderRequest = { 'bidderCode': 'oneVideo', From c7443b7fc74ed480d8797b20df51ca00f3c82da2 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 17:34:20 +0300 Subject: [PATCH 04/24] fix to playerSize array of array --- modules/oneVideoBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 45e34288f97..7db9a223679 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -29,8 +29,8 @@ export const spec = { } if ((typeof bid.mediaTypes.video.playerSize === 'undefined' || - typeof bid.mediaTypes.video.playerSize[0] === 'undefined' || - typeof bid.mediaTypes.video.playerSize[1] === 'undefined') && + typeof bid.mediaTypes.video.playerSize[0][0] === 'undefined' || + typeof bid.mediaTypes.video.playerSize[0][1] === 'undefined') && (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined')) { utils.logError('++++ player size missing in mediaTypes or params'); From 7b6e040bf4d7f3d4cd878f4b3af3bcb3ab70357b Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 17:38:27 +0300 Subject: [PATCH 05/24] fix mediaTypes evaluation --- modules/oneVideoBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 7db9a223679..42396f363f1 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -30,7 +30,7 @@ export const spec = { if ((typeof bid.mediaTypes.video.playerSize === 'undefined' || typeof bid.mediaTypes.video.playerSize[0][0] === 'undefined' || - typeof bid.mediaTypes.video.playerSize[0][1] === 'undefined') && + typeof bid.mediaTypes.video.playerSize[0][1] === 'undefined') || (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined')) { utils.logError('++++ player size missing in mediaTypes or params'); From a1d0fca298dd457922381baa651381b28758c452 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 18:12:27 +0300 Subject: [PATCH 06/24] handle w/h overrides --- modules/oneVideoBidAdapter.js | 23 +++++++++++-------- .../modules/liveIntentIdMinimalSystem_spec.js | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 42396f363f1..acdaf6fc3dc 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -28,14 +28,15 @@ export const spec = { return false; } - if ((typeof bid.mediaTypes.video.playerSize === 'undefined' || - typeof bid.mediaTypes.video.playerSize[0][0] === 'undefined' || - typeof bid.mediaTypes.video.playerSize[0][1] === 'undefined') || - (typeof bid.params.video.playerWidth === 'undefined' || - typeof bid.params.video.playerHeight === 'undefined')) { - utils.logError('++++ player size missing in mediaTypes or params'); + // MediaTypes / Params player size validation + if (typeof bid.mediaTypes.video.playerSize === 'undefined' && (typeof bid.params.video.playerWidth === 'undefined' || + typeof bid.params.video.playerHeight === 'undefined')) { + utils.logError('++++ playerSize missing in mediaTypes or bid.params'); return false; - } else if (typeof bid.mediaTypes.video.mimes === 'undefined' || typeof bid.params.video.mimes === 'undefined') { + }; + + // MediaTypes / Params mimes validation + if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { utils.logError('++++ mimes missing in mediaTypes or bid.params.video'); return false; } @@ -209,10 +210,14 @@ function getRequestData(bid, consentData, bidRequest) { if (bid.params.video.display == undefined || bid.params.video.display != 1) { bidData.imp[0].video = { mimes: bid.mediaTypes.video.mimes || bid.params.video.mimes, - w: bid.mediaTypes.video.playerSize[0] || bid.params.video.playerWidth, - h: bid.mediaTypes.video.playerSize[1] || bid.params.video.playerHeight, + w: bid.mediaTypes.video.playerSize[0][0], + h: bid.mediaTypes.video.playerSize[0][1], pos: bid.params.video.position, }; + if (bid.params.video.playerWidth && bid.params.video.playerHeight) { + bidData.imp[0].video.w = bid.params.video.playerWidth; + bidData.imp[0].video.h = bid.params.video.playerHeight; + } if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) { bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.params.video.maxbitrate; } diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js index 45d8dfbcf76..b0f97ae0300 100644 --- a/test/spec/modules/liveIntentIdMinimalSystem_spec.js +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -7,7 +7,7 @@ const PUBLISHER_ID = '89899'; const defaultConfigParams = { params: {publisherId: PUBLISHER_ID} }; const responseHeader = {'Content-Type': 'application/json'}; -xdescribe('LiveIntentMinimalId', function() { +describe('LiveIntentMinimalId', function() { let logErrorStub; let uspConsentDataStub; let gdprConsentDataStub; From 975249034eecbd631171ef240d288401f2786439 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 18:21:08 +0300 Subject: [PATCH 07/24] override mimes --- modules/oneVideoBidAdapter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index acdaf6fc3dc..ed9adbbb9f7 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -209,17 +209,20 @@ function getRequestData(bid, consentData, bidRequest) { if (bid.params.video.display == undefined || bid.params.video.display != 1) { bidData.imp[0].video = { - mimes: bid.mediaTypes.video.mimes || bid.params.video.mimes, + mimes: bid.mediaTypes.video.mimes, w: bid.mediaTypes.video.playerSize[0][0], h: bid.mediaTypes.video.playerSize[0][1], pos: bid.params.video.position, }; + if (bid.params.video.mimes) { + bidData.imp[0].video.mimes = bid.params.video.mimes; + } if (bid.params.video.playerWidth && bid.params.video.playerHeight) { bidData.imp[0].video.w = bid.params.video.playerWidth; bidData.imp[0].video.h = bid.params.video.playerHeight; } if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) { - bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.params.video.maxbitrate; + bidData.imp[0].video.maxbitrate = bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate; } if (bid.mediaTypes.video.maxduration || bid.params.video.maxduration) { bidData.imp[0].video.maxduration = bid.mediaTypes.video.maxduration || bid.params.video.maxduration; From 54abfb031c2d137d830085d0ee191da2bb1854b6 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 18:46:50 +0300 Subject: [PATCH 08/24] fixing failover default for mediaType params --- modules/oneVideoBidAdapter.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index ed9adbbb9f7..b0550e00a5e 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -222,35 +222,35 @@ function getRequestData(bid, consentData, bidRequest) { bidData.imp[0].video.h = bid.params.video.playerHeight; } if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) { - bidData.imp[0].video.maxbitrate = bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate; + bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.mediaTypes.video.maxbitrate; } if (bid.mediaTypes.video.maxduration || bid.params.video.maxduration) { - bidData.imp[0].video.maxduration = bid.mediaTypes.video.maxduration || bid.params.video.maxduration; + bidData.imp[0].video.maxduration = bid.params.video.maxduration || bid.mediaTypes.video.maxduration; } if (bid.mediaTypes.video.minduration || bid.params.video.minduration) { - bidData.imp[0].video.minduration = bid.mediaTypes.video.minduration || bid.params.video.minduration; + bidData.imp[0].video.minduration = bid.params.video.minduration || bid.mediaTypes.video.minduration; } if (bid.mediaTypes.video.api || bid.params.video.api) { - bidData.imp[0].video.api = bid.mediaTypes.video.api || bid.params.video.api; + bidData.imp[0].video.api = bid.params.video.api || bid.mediaTypes.video.api; } if (bid.mediaTypes.video.delivery || bid.params.video.delivery) { - bidData.imp[0].video.delivery = bid.mediaTypes.video.delivery || bid.params.video.delivery; + bidData.imp[0].video.delivery = bid.params.video.delivery || bid.mediaTypes.video.delivery; } if (bid.mediaTypes.video.position || bid.params.video.position) { - bidData.imp[0].video.pos = bid.mediaTypes.video.position || bid.params.video.position; + bidData.imp[0].video.pos = bid.params.video.position || bid.mediaTypes.video.position; } if (bid.mediaTypes.video.playbackmethod || bid.params.video.playbackmethod) { - bidData.imp[0].video.playbackmethod = bid.mediaTypes.video.playbackmethod || bid.params.video.playbackmethod; + bidData.imp[0].video.playbackmethod = bid.params.video.playbackmethod || bid.mediaTypes.video.playbackmethod; } if (bid.mediaTypes.video.placement || bid.params.video.placement) { - bidData.imp[0].video.placement = bid.mediaTypes.video.placement || bid.params.video.placement; + bidData.imp[0].video.placement = bid.params.video.placement || bid.mediaTypes.video.placement; } if (bid.params.video.rewarded) { bidData.imp[0].ext.rewarded = bid.params.video.rewarded } bidData.imp[0].video.linearity = 1; if (bid.mediaTypes.video.protocols || bid.params.video.protocols) { - bidData.imp[0].video.protocols = bid.mediaTypes.video.protocols || bid.params.video.protocols || [2, 5]; + bidData.imp[0].video.protocols = bid.params.video.protocols || bid.mediaTypes.video.protocols || [2, 5]; } } else if (bid.params.video.display == 1) { getFloorRequestObject.mediaType = 'banner'; From 76b0506367e2ff71cac605d48cafdc3c901ecea7 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Mon, 31 May 2021 19:05:20 +0300 Subject: [PATCH 09/24] added validation debug errors --- modules/oneVideoBidAdapter.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index b0550e00a5e..853b89510b3 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -17,33 +17,33 @@ export const spec = { * @return boolean True if this is a valid bid, and false otherwise. */ isBidRequestValid: function(bid) { - utils.logMessage('++++ validate request bid obj: ', bid); if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') { return false; } // Video/Banner validations if (typeof bid.mediaTypes.video === 'undefined' && bid.mediaTypes.banner === 'undefined') { - utils.logError('++++ mediaTypes.video OR mediaTypes.banner missing'); + utils.logError('Failed validation: adUnit mediaTypes.video AND/OR mediaTypes.banner not declared'); return false; } // MediaTypes / Params player size validation if (typeof bid.mediaTypes.video.playerSize === 'undefined' && (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined')) { - utils.logError('++++ playerSize missing in mediaTypes or bid.params'); + utils.logError('Failed validation: adUnit mediaTypes.playerSize OR params.video.plauerWidth/playerHeight not declared'); return false; }; // MediaTypes / Params mimes validation if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { - utils.logError('++++ mimes missing in mediaTypes or bid.params.video'); + utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); return false; } // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support if (bid.mediaTypes.video) { if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { + utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); return false; } } else if (bid.mediaTypes.banner && !bid.params.video.display) { @@ -52,6 +52,7 @@ export const spec = { // Pub Id validation if (typeof bid.params.pubId === 'undefined') { + utils.logError('Failed validation: Missing mandatory setting bid.params.pubId'); return false; } From 7e127ec1e8f9ed34d20da4331da8c2e98efdea20 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Tue, 1 Jun 2021 13:18:24 +0300 Subject: [PATCH 10/24] updated validations --- modules/oneVideoBidAdapter.js | 45 ++++++++++---------- test/spec/modules/oneVideoBidAdapter_spec.js | 42 ++++++++++++------ 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 853b89510b3..d30458df715 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -4,7 +4,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js'; const BIDDER_CODE = 'oneVideo'; export const spec = { code: 'oneVideo', - VERSION: '3.1.0', + VERSION: '3.1.1', ENDPOINT: 'https://ads.adaptv.advertising.com/rtb/openrtb?ext_id=', E2ETESTENDPOINT: 'https://ads-wc.v.ssp.yahoo.com/rtb/openrtb?ext_id=', SYNC_ENDPOINT1: 'https://pixel.advertising.com/ups/57304/sync?gdpr=&gdpr_consent=&_origin=0&redir=true', @@ -21,38 +21,37 @@ export const spec = { return false; } - // Video/Banner validations - if (typeof bid.mediaTypes.video === 'undefined' && bid.mediaTypes.banner === 'undefined') { - utils.logError('Failed validation: adUnit mediaTypes.video AND/OR mediaTypes.banner not declared'); + // Video / Banner validations + if (typeof bid.mediaTypes.video === 'undefined' && typeof bid.mediaTypes.banner === 'undefined') { + utils.logError('Failed validation: adUnit mediaTypes.video OR mediaTypes.banner not declared'); return false; - } - - // MediaTypes / Params player size validation - if (typeof bid.mediaTypes.video.playerSize === 'undefined' && (typeof bid.params.video.playerWidth === 'undefined' || - typeof bid.params.video.playerHeight === 'undefined')) { - utils.logError('Failed validation: adUnit mediaTypes.playerSize OR params.video.plauerWidth/playerHeight not declared'); - return false; - }; - - // MediaTypes / Params mimes validation - if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { - utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); - return false; - } - - // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support - if (bid.mediaTypes.video) { + } else if (bid.mediaTypes.video) { + // Player size validations + if (typeof bid.mediaTypes.video.playerSize === 'undefined') { + if (typeof bid.params.video.playerWidth === 'undefined' || + typeof bid.params.video.playerHeight === 'undefined') { + utils.logError('Failed validation: adUnit mediaTypes.playerSize OR params.video.plauerWidth/playerHeight not declared'); + return false; + }; + }; + // MediaTypes / Params mimes validation + if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { + utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); + return false; + }; + // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); return false; } } else if (bid.mediaTypes.banner && !bid.params.video.display) { + utils.logError('Failed validation: Cannot request Dynamic Ad Placement without params.video.display=1'); return false; } // Pub Id validation if (typeof bid.params.pubId === 'undefined') { - utils.logError('Failed validation: Missing mandatory setting bid.params.pubId'); + utils.logError('Failed validation: Adapter cannot send requests without bid.params.pubId'); return false; } @@ -332,7 +331,7 @@ function getRequestData(bid, consentData, bidRequest) { } } if (bid.params.video.e2etest) { - utils.logMessage('+++ oneVideoBidAdapter: E2E test mode enabled. \n The following parameters are being overridden by e2etest mode:\n* bidfloor:null\n* width:300\n* height:250\n* mimes: video/mp4, application/javascript\n* api:2\n* site.page/ref: verizonmedia.com\n* tmax:1000'); + utils.logMessage('E2E test mode enabled: \n The following parameters are being overridden by e2etest mode:\n* bidfloor:null\n* width:300\n* height:250\n* mimes: video/mp4, application/javascript\n* api:2\n* site.page/ref: verizonmedia.com\n* tmax:1000'); bidData.imp[0].bidfloor = null; bidData.imp[0].video.w = 300; bidData.imp[0].video.h = 250; diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 57449ef9728..464d8638618 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { spec } from 'modules/oneVideoBidAdapter.js'; -xdescribe('OneVideoBidAdapter', function () { +describe('OneVideoBidAdapter', function () { let bidRequest; let bidderRequest = { 'bidderCode': 'oneVideo', @@ -59,11 +59,33 @@ xdescribe('OneVideoBidAdapter', function () { }); describe('spec.isBidRequestValid', function () { - it('should return true when the required params are passed', function () { + it('should return true when mediaTypes.video has mandatory params', function () { + bidRequest.mediaTypes.video = { + context: 'instream', + playerSize: [640, 480], + mimes: ['video/mp4', 'application/javascript'], + } + bidRequest.video = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the "video" param is missing', function () { + it('should return true when params.video override params are passed', function () { + bidRequest.mediaTypes.video = { + context: 'instream', + playerSize: [640, 480] + } + bidRequest.video = { + playerWidth: 640, + playerHeight: 480, + mimes: ['video/mp4', 'application/javascript'] + }; + expect(spec.isBidRequestValid(bidRequest)).to.equal(true); + }); + + it('should return false when the both mediaTypes.video and params.video are missing', function () { + bidRequest.mediaTypes.video = { + context: 'instream' + } bidRequest.params = { pubId: 'brxd' }; @@ -76,19 +98,11 @@ xdescribe('OneVideoBidAdapter', function () { playerWidth: 480, playerHeight: 640, mimes: ['video/mp4', 'application/javascript'], - protocols: [2, 5], - api: [2], - position: 1, - delivery: [2], - playbackmethod: [1, 5], - sid: 134, - rewarded: 1, - placement: 1, - inventoryid: 123 } }; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); + it('should return true when the "pubId" param exists', function () { bidRequest.params = { video: { @@ -111,7 +125,7 @@ xdescribe('OneVideoBidAdapter', function () { }); it('should return false when no bid params are passed', function () { - bidRequest.params = {}; + bidRequest.params.video = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); @@ -216,7 +230,7 @@ xdescribe('OneVideoBidAdapter', function () { const placement = bidRequest.params.video.placement; const rewarded = bidRequest.params.video.rewarded; const inventoryid = bidRequest.params.video.inventoryid; - const VERSION = '3.1.0'; + const VERSION = '3.1.1'; expect(data.imp[0].video.w).to.equal(width); expect(data.imp[0].video.h).to.equal(height); expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor); From 547392c481c3931f67ce82977f41b6770921363f Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Tue, 1 Jun 2021 13:19:22 +0300 Subject: [PATCH 11/24] formatting fix --- modules/oneVideoBidAdapter.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index d30458df715..1c2d00000a0 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -28,8 +28,7 @@ export const spec = { } else if (bid.mediaTypes.video) { // Player size validations if (typeof bid.mediaTypes.video.playerSize === 'undefined') { - if (typeof bid.params.video.playerWidth === 'undefined' || - typeof bid.params.video.playerHeight === 'undefined') { + if (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined') { utils.logError('Failed validation: adUnit mediaTypes.playerSize OR params.video.plauerWidth/playerHeight not declared'); return false; }; From 435a46a991e26e2c0ef3e720c41bc3a29254c866 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 12:05:23 +0300 Subject: [PATCH 12/24] updated valdiations --- modules/oneVideoBidAdapter.js | 32 +++++++---- test/spec/modules/oneVideoBidAdapter_spec.js | 58 ++++++++++++-------- 2 files changed, 57 insertions(+), 33 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 1c2d00000a0..ed159d17892 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -17,38 +17,48 @@ export const spec = { * @return boolean True if this is a valid bid, and false otherwise. */ isBidRequestValid: function(bid) { + // Bidder code validation if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') { return false; } - // Video / Banner validations + // MediaTypes Video / Banner validation if (typeof bid.mediaTypes.video === 'undefined' && typeof bid.mediaTypes.banner === 'undefined') { utils.logError('Failed validation: adUnit mediaTypes.video OR mediaTypes.banner not declared'); return false; - } else if (bid.mediaTypes.video) { - // Player size validations + }; + + if (bid.mediaTypes.video) { + // MediaTypes video validations if (typeof bid.mediaTypes.video.playerSize === 'undefined') { + // bidder params override validation + if (typeof bid.params.video === 'undefined') { + utils.logError('Failed validation: adUnit is missing Player size parameters. Use either mediaTypes.playerSize OR params.video.plauerWidth & playerHeight.'); + return false; + } + // Player size validation if (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined') { - utils.logError('Failed validation: adUnit mediaTypes.playerSize OR params.video.plauerWidth/playerHeight not declared'); + utils.logError('Failed validation: bid.params.video exists but is missing plauerWidth & playerHeight. Use either mediaTypes.playerSize OR params.video.plauerWidth & playerHeight.'); + return false; + }; + // Mimes validation + if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { + utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); return false; }; - }; - // MediaTypes / Params mimes validation - if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { - utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); - return false; }; // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); return false; } + // DAP Validation } else if (bid.mediaTypes.banner && !bid.params.video.display) { - utils.logError('Failed validation: Cannot request Dynamic Ad Placement without params.video.display=1'); + utils.logError('Failed validation: If you are trying to use Dynamic Ad Placement you must pass params.video.display=1'); return false; } - // Pub Id validation + // Publisher Id (Exchange) validation if (typeof bid.params.pubId === 'undefined') { utils.logError('Failed validation: Adapter cannot send requests without bid.params.pubId'); return false; diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 464d8638618..9de1c41735e 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -65,16 +65,15 @@ describe('OneVideoBidAdapter', function () { playerSize: [640, 480], mimes: ['video/mp4', 'application/javascript'], } - bidRequest.video = {}; + bidRequest.params.video = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return true when params.video override params are passed', function () { + it('should return true when params.video override params are passed instead of mediaTypes.video', function () { bidRequest.mediaTypes.video = { - context: 'instream', - playerSize: [640, 480] - } - bidRequest.video = { + context: 'instream' + }; + bidRequest.params.video = { playerWidth: 640, playerHeight: 480, mimes: ['video/mp4', 'application/javascript'] @@ -82,9 +81,34 @@ describe('OneVideoBidAdapter', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the both mediaTypes.video and params.video are missing', function () { + it('should return true when mimes are passed in mediaTypes', function () { bidRequest.mediaTypes.video = { - context: 'instream' + context: 'instream', + mimes: ['video/mp4', 'application/javascript'] + }; + bidRequest.params.video = { + playerWidth: 640, + playerHeight: 480, + }; + expect(spec.isBidRequestValid(bidRequest)).to.equal(true); + }); + + it('should return true when player size is passed in mediaTypes', function () { + bidRequest.mediaTypes.video = { + context: 'instream', + playerSizes: [640, 480] + }; + bidRequest.video = { + mimes: ['video/mp4', 'application/javascript'] + }; + expect(spec.isBidRequestValid(bidRequest)).to.equal(true); + }); + + it('should return false when both mediaTypes.video and params.video are missing mandatory params', function () { + bidRequest.mediaTypes = { + video: { + context: 'instream' + } } bidRequest.params = { pubId: 'brxd' @@ -104,20 +128,10 @@ describe('OneVideoBidAdapter', function () { }); it('should return true when the "pubId" param exists', function () { - bidRequest.params = { + bidRequest.mediaTypes = { video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2, 5], - api: [2], - position: 1, - delivery: [2], - playbackmethod: [1, 5], - sid: 134, - rewarded: 1, - placement: 1, - inventoryid: 123 + playerSizes: [640, 480], + mimes: ['video/mp4', 'application/javascript'] }, pubId: 'brxd' }; @@ -125,7 +139,7 @@ describe('OneVideoBidAdapter', function () { }); it('should return false when no bid params are passed', function () { - bidRequest.params.video = {}; + bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); From 4ddf97453b151d50a3724e326d93959040f604ac Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 12:56:06 +0300 Subject: [PATCH 13/24] updated .md file --- modules/oneVideoBidAdapter.js | 5 +++++ modules/oneVideoBidAdapter.md | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index ed159d17892..a9dc3d59171 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -28,6 +28,11 @@ export const spec = { return false; }; + if (typeof bid.params.video === 'undefined') { + utils.logError('Failed validation: bid.params.video Object not declared'); + return false; + } + if (bid.mediaTypes.video) { // MediaTypes video validations if (typeof bid.mediaTypes.video.playerSize === 'undefined') { diff --git a/modules/oneVideoBidAdapter.md b/modules/oneVideoBidAdapter.md index a42433e80b5..e5367c25913 100644 --- a/modules/oneVideoBidAdapter.md +++ b/modules/oneVideoBidAdapter.md @@ -3,10 +3,14 @@ **Module Name**: One Video Bidder Adapter **Module Type**: Bidder Adapter **Maintainer**: deepthi.neeladri.sravana@verizonmedia.com + adam.browning@verizonmedia.com # Description Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to fetch bids. - +# Prebid.js V5.0 Support +The oneVideo adapter now reads `mediaTypes.video` for mandatory parameters such as `playerSize` & `mimes`. +Note: You can use the `bid.params.video` object to specify explicit overrides for whatever is declared in `mediaTypes.video`. +Important: You must pass `bid.params.video = {}` as bare minimum for the adapter to work. # Integration Examples: ## Instream Video adUnit example & parameters *Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player. @@ -298,7 +302,7 @@ var adUnits = [ id: 1, page: 'https://verizonmedia.com', referrer: 'https://verizonmedia.com' - }, + }, pubId: 'HBExchange' } } From 3b5bb7ed7d33d1545439bbcb9a1757794f846841 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 17:48:44 +0300 Subject: [PATCH 14/24] updated logic --- modules/oneVideoBidAdapter.js | 47 ++++++++++++++--------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index a9dc3d59171..db5a6e364cf 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -28,40 +28,29 @@ export const spec = { return false; }; - if (typeof bid.params.video === 'undefined') { - utils.logError('Failed validation: bid.params.video Object not declared'); - return false; - } - if (bid.mediaTypes.video) { - // MediaTypes video validations - if (typeof bid.mediaTypes.video.playerSize === 'undefined') { - // bidder params override validation - if (typeof bid.params.video === 'undefined') { - utils.logError('Failed validation: adUnit is missing Player size parameters. Use either mediaTypes.playerSize OR params.video.plauerWidth & playerHeight.'); - return false; - } - // Player size validation - if (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined') { - utils.logError('Failed validation: bid.params.video exists but is missing plauerWidth & playerHeight. Use either mediaTypes.playerSize OR params.video.plauerWidth & playerHeight.'); - return false; - }; - // Mimes validation - if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { - utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); - return false; - }; + // Player size validation + if (typeof bid.mediaTypes.video.playerSize === 'undefined' && (bid.params.video && (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined'))) { + utils.logError('Failed validation: Player size not declared in either mediaTypes.playerSize OR bid.params.video.plauerWidth & bid.params.video.playerHeight.'); + return false; }; - // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support - if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { - utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); + // Mimes validation + if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { + utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); return false; - } - // DAP Validation - } else if (bid.mediaTypes.banner && !bid.params.video.display) { + }; + }; + + // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support + if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { + utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); + return false; + }; + // DAP Validation + if (bid.mediaTypes.banner && !bid.params.video.display) { utils.logError('Failed validation: If you are trying to use Dynamic Ad Placement you must pass params.video.display=1'); return false; - } + }; // Publisher Id (Exchange) validation if (typeof bid.params.pubId === 'undefined') { From 6186dbb65168ee63dc910bf1b655e8af33f38f2c Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 19:35:55 +0300 Subject: [PATCH 15/24] logic update --- modules/oneVideoBidAdapter.js | 20 ++++++++++++-------- test/spec/modules/oneVideoBidAdapter_spec.js | 10 +++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index db5a6e364cf..66004be091f 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -30,16 +30,20 @@ export const spec = { if (bid.mediaTypes.video) { // Player size validation - if (typeof bid.mediaTypes.video.playerSize === 'undefined' && (bid.params.video && (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined'))) { - utils.logError('Failed validation: Player size not declared in either mediaTypes.playerSize OR bid.params.video.plauerWidth & bid.params.video.playerHeight.'); - return false; + if (typeof bid.mediaTypes.video.playerSize === 'undefined') { + if (bid.params.video && (typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight === 'undefined')) { + utils.logError('Failed validation: Player size not declared in either mediaTypes.playerSize OR bid.params.video.plauerWidth & bid.params.video.playerHeight.'); + return false; + }; }; // Mimes validation - if (typeof bid.mediaTypes.video.mimes === 'undefined' && typeof bid.params.video.mimes === 'undefined') { - utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); - return false; + if (typeof bid.mediaTypes.video.mimes === 'undefined') { + if (bid.params.video && typeof bid.params.video.mimes === 'undefined') { + utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); + return false; + }; }; - }; + } // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { @@ -67,7 +71,7 @@ export const spec = { * @param bidderRequest * @return ServerRequest Info describing the request to the server. */ - buildRequests: function(bids, bidRequest) { + buildRequests: function (bids, bidRequest) { let consentData = bidRequest ? bidRequest.gdprConsent : null; return bids.map(bid => { diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 9de1c41735e..2fea888b3d9 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -59,7 +59,7 @@ describe('OneVideoBidAdapter', function () { }); describe('spec.isBidRequestValid', function () { - it('should return true when mediaTypes.video has mandatory params', function () { + it('should return true when mediaTypes.video has all mandatory params', function () { bidRequest.mediaTypes.video = { context: 'instream', playerSize: [640, 480], @@ -69,7 +69,7 @@ describe('OneVideoBidAdapter', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return true when params.video override params are passed instead of mediaTypes.video', function () { + it('should return true when params.video has all override params instead of mediaTypes.video', function () { bidRequest.mediaTypes.video = { context: 'instream' }; @@ -81,7 +81,7 @@ describe('OneVideoBidAdapter', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return true when mimes are passed in mediaTypes', function () { + it('should return true when playerWidth & playerHeight are passed in params.video', function () { bidRequest.mediaTypes.video = { context: 'instream', mimes: ['video/mp4', 'application/javascript'] @@ -93,7 +93,7 @@ describe('OneVideoBidAdapter', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return true when player size is passed in mediaTypes', function () { + it('should return true when mimes is passed in params.video', function () { bidRequest.mediaTypes.video = { context: 'instream', playerSizes: [640, 480] @@ -104,7 +104,7 @@ describe('OneVideoBidAdapter', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when both mediaTypes.video and params.video are missing mandatory params', function () { + it('should return false when both mediaTypes.video and params.video are missing mimes and player size params', function () { bidRequest.mediaTypes = { video: { context: 'instream' From 8533a219b9f5cd65fe998f083f780967f4da3c57 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 19:47:36 +0300 Subject: [PATCH 16/24] updated logic --- modules/oneVideoBidAdapter.js | 14 +++++++------- test/spec/modules/oneVideoBidAdapter_spec.js | 12 ++++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 66004be091f..5ef8ee24207 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -38,18 +38,18 @@ export const spec = { }; // Mimes validation if (typeof bid.mediaTypes.video.mimes === 'undefined') { - if (bid.params.video && typeof bid.params.video.mimes === 'undefined') { + if (!bid.params.video || typeof bid.params.video.mimes === 'undefined') { utils.logError('Failed validation: adUnit mediaTypes.mimes OR params.video.mimes not declared'); return false; }; }; - } - - // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support - if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { - utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); - return false; + // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support + if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { + utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); + return false; + }; }; + // DAP Validation if (bid.mediaTypes.banner && !bid.params.video.display) { utils.logError('Failed validation: If you are trying to use Dynamic Ad Placement you must pass params.video.display=1'); diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 2fea888b3d9..4df100ad793 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -104,12 +104,20 @@ describe('OneVideoBidAdapter', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when both mediaTypes.video and params.video are missing mimes and player size params', function () { + it('should return false when both mediaTypes.video and params.video Objects are missing', function () { + bidRequest.mediaTypes = {}; + bidRequest.params = { + pubId: 'brxd' + }; + expect(spec.isBidRequestValid(bidRequest)).to.equal(false); + }); + + it('should return false when both mediaTypes.video and params.video are missing mimes and player size', function () { bidRequest.mediaTypes = { video: { context: 'instream' } - } + }; bidRequest.params = { pubId: 'brxd' }; From f1b0f10992b7acdb8a33f734634d17bf3f360fc3 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 20:29:53 +0300 Subject: [PATCH 17/24] changes to bidResponse interpretation --- modules/oneVideoBidAdapter.js | 17 ++++++++++------- test/spec/modules/oneVideoBidAdapter_spec.js | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 5ef8ee24207..a3aa730f845 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -216,18 +216,21 @@ function getRequestData(bid, consentData, bidRequest) { if (bid.params.video.display == undefined || bid.params.video.display != 1) { bidData.imp[0].video = { - mimes: bid.mediaTypes.video.mimes, - w: bid.mediaTypes.video.playerSize[0][0], - h: bid.mediaTypes.video.playerSize[0][1], pos: bid.params.video.position, }; - if (bid.params.video.mimes) { - bidData.imp[0].video.mimes = bid.params.video.mimes; - } if (bid.params.video.playerWidth && bid.params.video.playerHeight) { bidData.imp[0].video.w = bid.params.video.playerWidth; bidData.imp[0].video.h = bid.params.video.playerHeight; - } + } else if (bid.mediaTypes.video.playerSize) { + const playerSize = getSize(bid.mediaTypes.video.playerSize); + bidData.imp[0].video.w = playerSize.width; + bidData.imp[0].video.h = playerSize.height; + }; + if (bid.mediaTypes.video.mimes) { + bidData.imp[0].video.mimes = bid.mediaTypes.video.mimes; + } else if (bid.params.video.mimes) { + bidData.imp[0].video.mimes = bid.params.video.mimes; + }; if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) { bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.mediaTypes.video.maxbitrate; } diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 4df100ad793..5b8498dc5a9 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -248,7 +248,7 @@ describe('OneVideoBidAdapter', function () { it('should attach request data', function () { const requests = spec.buildRequests([bidRequest], bidderRequest); const data = requests[0].data; - const [width, height] = bidRequest.sizes; + const [width, height] = bidRequest.playerSize; const placement = bidRequest.params.video.placement; const rewarded = bidRequest.params.video.rewarded; const inventoryid = bidRequest.params.video.inventoryid; From 04b20c37392a44bf4c73521843a8e431e0a7761c Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 21:58:53 +0300 Subject: [PATCH 18/24] added skip validations for e2etest --- modules/oneVideoBidAdapter.js | 16 ++++++++++------ test/spec/modules/oneVideoBidAdapter_spec.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index a3aa730f845..d59b02ce894 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -22,6 +22,10 @@ export const spec = { return false; } + // E2E test skip validations + if (bid.params && bid.params.video && bid.params.video.e2etest) { + return true; + } // MediaTypes Video / Banner validation if (typeof bid.mediaTypes.video === 'undefined' && typeof bid.mediaTypes.banner === 'undefined') { utils.logError('Failed validation: adUnit mediaTypes.video OR mediaTypes.banner not declared'); @@ -44,14 +48,14 @@ export const spec = { }; }; // Prevend DAP Outstream validation, Banner DAP validation & Multi-Format adUnit support - if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { + if (bid.mediaTypes.video.context === 'outstream' && bid.params.video && bid.params.video.display === 1) { utils.logError('Failed validation: Dynamic Ad Placement cannot be used with context Outstream (params.video.display=1)'); return false; }; }; // DAP Validation - if (bid.mediaTypes.banner && !bid.params.video.display) { + if (bid.mediaTypes.banner && bid.params.video && !bid.params.video.display) { utils.logError('Failed validation: If you are trying to use Dynamic Ad Placement you must pass params.video.display=1'); return false; }; @@ -221,15 +225,15 @@ function getRequestData(bid, consentData, bidRequest) { if (bid.params.video.playerWidth && bid.params.video.playerHeight) { bidData.imp[0].video.w = bid.params.video.playerWidth; bidData.imp[0].video.h = bid.params.video.playerHeight; - } else if (bid.mediaTypes.video.playerSize) { + } else { const playerSize = getSize(bid.mediaTypes.video.playerSize); bidData.imp[0].video.w = playerSize.width; bidData.imp[0].video.h = playerSize.height; }; - if (bid.mediaTypes.video.mimes) { - bidData.imp[0].video.mimes = bid.mediaTypes.video.mimes; - } else if (bid.params.video.mimes) { + if (bid.params.video.mimes) { bidData.imp[0].video.mimes = bid.params.video.mimes; + } else { + bidData.imp[0].video.mimes = bid.mediaTypes.video.mimes; }; if (bid.mediaTypes.video.maxbitrate || bid.params.video.maxbitrate) { bidData.imp[0].video.maxbitrate = bid.params.video.maxbitrate || bid.mediaTypes.video.maxbitrate; diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 5b8498dc5a9..4df100ad793 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -248,7 +248,7 @@ describe('OneVideoBidAdapter', function () { it('should attach request data', function () { const requests = spec.buildRequests([bidRequest], bidderRequest); const data = requests[0].data; - const [width, height] = bidRequest.playerSize; + const [width, height] = bidRequest.sizes; const placement = bidRequest.params.video.placement; const rewarded = bidRequest.params.video.rewarded; const inventoryid = bidRequest.params.video.inventoryid; From a56e55a25e048e8a43a70b7321f919d87b6525f4 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 2 Jun 2021 22:04:44 +0300 Subject: [PATCH 19/24] updated unit test for e2e skip validation --- test/spec/modules/oneVideoBidAdapter_spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 4df100ad793..887b8f0db5b 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -59,6 +59,18 @@ describe('OneVideoBidAdapter', function () { }); describe('spec.isBidRequestValid', function () { + it('should return false when mediaTypes video OR banner not declared', function () { + bidRequest.mediaTypes = {}; + expect(spec.isBidRequestValid(bidRequest)).to.equal(false); + }); + + it('should return true (skip validations) when e2etest = true', function () { + bidRequest.params.video = { + e2etest: true + }; + expect(spec.isBidRequestValid(bidRequest)).to.equal(true); + }); + it('should return true when mediaTypes.video has all mandatory params', function () { bidRequest.mediaTypes.video = { context: 'instream', From 3e660ba160b436a9ecc7b151db7fabd785871d30 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 3 Jun 2021 10:50:29 +0300 Subject: [PATCH 20/24] meta.advertiserDomains support --- modules/oneVideoBidAdapter.js | 5 ++++- test/spec/modules/oneVideoBidAdapter_spec.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index d59b02ce894..a004118753d 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -126,7 +126,10 @@ export const spec = { currency: response.cur, ttl: (bidRequest.params.video.ttl > 0 && bidRequest.params.video.ttl <= 3600) ? bidRequest.params.video.ttl : 300, netRevenue: true, - adUnitCode: bidRequest.adUnitCode + adUnitCode: bidRequest.adUnitCode, + meta: { + advertiserDomains: bid.adomain + } }; bidResponse.mediaType = (bidRequest.mediaTypes.banner) ? 'banner' : 'video' diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 887b8f0db5b..44567e3b02c 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -688,7 +688,10 @@ describe('OneVideoBidAdapter', function () { adid: 123, crid: 2, price: 6.01, - adm: '' + adm: '', + adomain: [ + 'verizonmedia.com' + ], }] }], cur: 'USD' @@ -712,6 +715,7 @@ describe('OneVideoBidAdapter', function () { netRevenue: true, adUnitCode: bidRequest.adUnitCode, renderer: (bidRequest.mediaTypes.video.context === 'outstream') ? newRenderer(bidRequest, bidResponse) : undefined, + adomain: ['verizonmedia.com'] }; expect(bidResponse).to.deep.equal(o); }); From 3524004cbd3cc7ffee004c1c8691c624908a4b38 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 3 Jun 2021 11:14:11 +0300 Subject: [PATCH 21/24] fixed typo + added test --- test/spec/modules/oneVideoBidAdapter_spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 44567e3b02c..5289203fd5b 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -715,7 +715,9 @@ describe('OneVideoBidAdapter', function () { netRevenue: true, adUnitCode: bidRequest.adUnitCode, renderer: (bidRequest.mediaTypes.video.context === 'outstream') ? newRenderer(bidRequest, bidResponse) : undefined, - adomain: ['verizonmedia.com'] + meta: { + advertiserDomains: ['verizonmedia.com'] + } }; expect(bidResponse).to.deep.equal(o); }); From a026df509128ff7430c598022b4fc7ebde9c6bee Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 3 Jun 2021 13:05:44 +0300 Subject: [PATCH 22/24] update to md file --- modules/oneVideoBidAdapter.js | 4 +- modules/oneVideoBidAdapter.md | 69 +++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index a004118753d..b29737a3c2f 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -222,9 +222,7 @@ function getRequestData(bid, consentData, bidRequest) { }; if (bid.params.video.display == undefined || bid.params.video.display != 1) { - bidData.imp[0].video = { - pos: bid.params.video.position, - }; + bidData.imp[0].video = {}; if (bid.params.video.playerWidth && bid.params.video.playerHeight) { bidData.imp[0].video.w = bid.params.video.playerWidth; bidData.imp[0].video.h = bid.params.video.playerHeight; diff --git a/modules/oneVideoBidAdapter.md b/modules/oneVideoBidAdapter.md index e5367c25913..10370494743 100644 --- a/modules/oneVideoBidAdapter.md +++ b/modules/oneVideoBidAdapter.md @@ -12,7 +12,9 @@ The oneVideo adapter now reads `mediaTypes.video` for mandatory parameters such Note: You can use the `bid.params.video` object to specify explicit overrides for whatever is declared in `mediaTypes.video`. Important: You must pass `bid.params.video = {}` as bare minimum for the adapter to work. # Integration Examples: -## Instream Video adUnit example & parameters + +## Instream Video adUnit using mediaTypes.video +*Note:* By default, the adapter will read the mandatory parameters from mediaTypes.video. *Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player. ``` var adUnits = [ @@ -21,7 +23,18 @@ Important: You must pass `bid.params.video = {}` as bare minimum for the adapter mediaTypes: { video: { context: 'instream', - playerSize: [480, 640] + playerSize: [480, 640], + mimes: ['video/mp4', 'application/javascript'], + protocols: [2,5], + api: [2], + position: 1, + delivery: [2], + minduration: 10, + maxduration: 30, + placement: 1, + playbackmethod: [1,5], + protocols: [2,5], + api: [2], } }, bids: [ @@ -29,21 +42,63 @@ Important: You must pass `bid.params.video = {}` as bare minimum for the adapter bidder: 'oneVideo', params: { video: { - playerWidth: 480, - playerHeight: 640, + sid: YOUR_VSSP_ORG_ID, + hp: 1, + rewarded: 1, + inventoryid: 123, + ttl: 300, + custom: { + key1: "value1", + key2: 123345 + } + }, + bidfloor: 0.5, + site: { + id: 1, + page: 'https://verizonmedia.com', + referrer: 'https://verizonmedia.com' + }, + pubId: 'HBExchange' + } + } + ] + } + ] +``` +## Instream Video adUnit using params.video overrides +*Note:* If the mandatory parameters are not specified in mediaTypes.video the adapter will read check to see if overrides are set in params.video. Decalring values using params.video will always override the settings in mediaTypes.video. +*Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player. +``` + var adUnits = [ + { + code: 'video1', + mediaTypes: { + video: { + context: 'instream', + } + }, + bids: [ + { + bidder: 'oneVideo', + params: { + video: { + playerWidth: 640, + playerHeight: 480, mimes: ['video/mp4', 'application/javascript'], protocols: [2,5], api: [2], position: 1, delivery: [2], + minduration: 10, + maxduration: 30, + placement: 1, playbackmethod: [1,5], + protocols: [2,5], + api: [2], sid: YOUR_VSSP_ORG_ID, hp: 1, rewarded: 1, - placement: 1, inventoryid: 123, - minduration: 10, - maxduration: 30, ttl: 300, custom: { key1: "value1", From afb0f2b2e65791f181b2a79cb0be8758fa90f9e1 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 3 Jun 2021 13:08:25 +0300 Subject: [PATCH 23/24] extended linearity support --- modules/oneVideoBidAdapter.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index b29737a3c2f..dfedbd156a9 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -222,7 +222,9 @@ function getRequestData(bid, consentData, bidRequest) { }; if (bid.params.video.display == undefined || bid.params.video.display != 1) { - bidData.imp[0].video = {}; + bidData.imp[0].video = { + linearity: 1 + }; if (bid.params.video.playerWidth && bid.params.video.playerHeight) { bidData.imp[0].video.w = bid.params.video.playerWidth; bidData.imp[0].video.h = bid.params.video.playerHeight; @@ -263,7 +265,9 @@ function getRequestData(bid, consentData, bidRequest) { if (bid.params.video.rewarded) { bidData.imp[0].ext.rewarded = bid.params.video.rewarded } - bidData.imp[0].video.linearity = 1; + if (bid.mediaTypes.video.linearity || bid.params.video.linearity) { + bidData.imp[0].video.linearity = bid.params.video.linearity || bid.mediaTypes.video.linearity || 1; + } if (bid.mediaTypes.video.protocols || bid.params.video.protocols) { bidData.imp[0].video.protocols = bid.params.video.protocols || bid.mediaTypes.video.protocols || [2, 5]; } From 6ab45313a1556489e5acf3bd6113c0b81ef54ab6 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 3 Jun 2021 13:19:57 +0300 Subject: [PATCH 24/24] updated all .md examples --- modules/oneVideoBidAdapter.md | 85 +++++++++++++++-------------------- 1 file changed, 36 insertions(+), 49 deletions(-) diff --git a/modules/oneVideoBidAdapter.md b/modules/oneVideoBidAdapter.md index 10370494743..c1762ac0cd3 100644 --- a/modules/oneVideoBidAdapter.md +++ b/modules/oneVideoBidAdapter.md @@ -127,7 +127,19 @@ Important: You must pass `bid.params.video = {}` as bare minimum for the adapter mediaTypes: { video: { context: 'outstream', - playerSize: [480, 640] + playerSize: [480, 640], + mimes: ['video/mp4', 'application/javascript'], + protocols: [2,5], + api: [2], + position: 1, + delivery: [2], + minduration: 10, + maxduration: 30, + placement: 1, + playbackmethod: [1,5], + protocols: [2,5], + api: [2], + } }, bids: [ @@ -135,21 +147,9 @@ Important: You must pass `bid.params.video = {}` as bare minimum for the adapter bidder: 'oneVideo', params: { video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2,5], - api: [2], - position: 1, - delivery: [2], - playbackmethod: [1,5], sid: YOUR_VSSP_ORG_ID, hp: 1, rewarded: 1, - placement: 1, - inventoryid: 123, - minduration: 10, - maxduration: 30, ttl: 250 }, bidfloor: 0.5, @@ -175,7 +175,8 @@ Important: You must pass `bid.params.video = {}` as bare minimum for the adapter mediaTypes: { video: { context: "instream", - playerSize: [480, 640] + playerSize: [480, 640], + mimes: ['video/mp4', 'application/javascript'], } }, bids: [ @@ -183,11 +184,7 @@ Important: You must pass `bid.params.video = {}` as bare minimum for the adapter bidder: 'oneVideo', params: { video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - position: 1, - display: 1 + ttl: 250 }, bidfloor: 0.5, site: { @@ -249,6 +246,7 @@ var adUnits = [ video: { context: "instream", playerSize: [480, 640] + mimes: ['video/mp4', 'application/javascript'], } }, bids: [ @@ -256,12 +254,8 @@ var adUnits = [ bidder: 'oneVideo', params: { video: { - playerWidth: 300, - playerHeight: 250, - mimes: ['video/mp4', 'application/javascript'], e2etest: true - }, - pubId: 'YOUR_PUBLISHER_ID' + } } } ] @@ -285,7 +279,10 @@ var adUnits = [ mediaTypes: { video: { context: 'instream', - playerSize: [480, 640] + playerSize: [480, 640], + mimes: ['video/mp4', 'application/javascript'], + protocols: [2,5], + api: [2], } }, bids: [ @@ -293,12 +290,7 @@ var adUnits = [ bidder: 'oneVideo', params: { video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2,5], - api: [2], - sid: + sid: 123456 }, bidfloor: 0.5, site: { @@ -338,7 +330,10 @@ var adUnits = [ mediaTypes: { video: { context: 'instream', - playerSize: [480, 640] + playerSize: [480, 640], + mimes: ['video/mp4', 'application/javascript'], + protocols: [2,5], + api: [2], } }, bids: [ @@ -346,11 +341,7 @@ var adUnits = [ bidder: 'oneVideo', params: { video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2,5], - api: [2], + ttl: 250 }, bidfloor: 0.5, site: { @@ -374,18 +365,16 @@ const adUnits = [{ mediaTypes: { video: { context: 'outstream', - playerSize: [640, 480] + playerSize: [640, 480], + mimes: ['video/mp4', 'application/javascript'], + protocols: [2, 5], + api: [1, 2], } }, bids: [{ bidder: 'oneVideo', params: { video: { - playerWidth: 640, - playerHeight: 480, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2, 5], - api: [1, 2], ttl: 300, content: { id: "1234", @@ -432,18 +421,16 @@ const adUnits = [{ mediaTypes: { video: { context: 'outstream', - playerSize: [640, 480] + playerSize: [640, 480], + mimes: ['video/mp4', 'application/javascript'], + protocols: [2, 5], + api: [1, 2], } }, bids: [{ bidder: 'oneVideo', params: { video: { - playerWidth: 640, - playerHeight: 480, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2, 5], - api: [1, 2], ttl: 300 }, bidfloor: 0.5,