From 5e0e15c3108c957a496625d574d49eb61874f3eb Mon Sep 17 00:00:00 2001 From: Rajkumar Natarajan Date: Tue, 11 Feb 2020 13:19:03 -0500 Subject: [PATCH 1/2] Implemented schain support for prebid and updated documentation examples for prebid3.0 --- modules/synacormediaBidAdapter.js | 9 ++ modules/synacormediaBidAdapter.md | 8 +- .../modules/synacormediaBidAdapter_spec.js | 92 +++++++++++++++++++ 3 files changed, 106 insertions(+), 3 deletions(-) diff --git a/modules/synacormediaBidAdapter.js b/modules/synacormediaBidAdapter.js index 3064ac2063b..160385ab3aa 100644 --- a/modules/synacormediaBidAdapter.js +++ b/modules/synacormediaBidAdapter.js @@ -44,6 +44,15 @@ export const spec = { }, imp: [] }; + + if (bidderRequest.bids && bidderRequest.bids[0]) { + const schain = bidderRequest.bids[0].schain; + if (schain) { + openRtbBidRequest.source = {}; + openRtbBidRequest.source.ext = { schain }; + } + } + let seatId = null; validBidReqs.forEach((bid, i) => { diff --git a/modules/synacormediaBidAdapter.md b/modules/synacormediaBidAdapter.md index 3a00aa45fed..857cf15d240 100644 --- a/modules/synacormediaBidAdapter.md +++ b/modules/synacormediaBidAdapter.md @@ -24,9 +24,11 @@ https://track.technoratimedia.com/openrtb/tags?ID=%%PATTERN:hb_cache_id_synacorm ``` var adUnits = [{ code: 'test-div', - sizes: [ - [300, 250] - ], + mediaTypes: { + banner: { + sizes: [[300, 250]] + } + }, bids: [{ bidder: "synacormedia", params: { diff --git a/test/spec/modules/synacormediaBidAdapter_spec.js b/test/spec/modules/synacormediaBidAdapter_spec.js index 918e4e394bd..41194cbdf51 100644 --- a/test/spec/modules/synacormediaBidAdapter_spec.js +++ b/test/spec/modules/synacormediaBidAdapter_spec.js @@ -535,6 +535,98 @@ describe('synacormediaBidAdapter ', function () { }); }); + describe('Bid Requests with schain object ', function() { + let validBidReq = { + bidder: 'synacormedia', + params: { + seatId: 'prebid', + placementId: 'demo1', + pos: 1, + video: {} + }, + renderer: { + url: '../syncOutstreamPlayer.js' + }, + mediaTypes: { + video: { + playerSize: [[300, 250]], + context: 'outstream' + } + }, + adUnitCode: 'div-1', + transactionId: '0869f34e-090b-4b20-84ee-46ff41405a39', + sizes: [[300, 250]], + bidId: '22b3a2268d9f0e', + bidderRequestId: '1d195910597e13', + auctionId: '3375d336-2aea-4ee7-804c-6d26b621ad20', + src: 'client', + bidRequestsCount: 1, + bidderRequestsCount: 1, + bidderWinsCount: 0 + }; + let bidderRequest = { + refererInfo: { + referer: 'http://localhost:9999/' + }, + bidderCode: 'synacormedia', + auctionId: 'f8a75621-d672-4cbb-9275-3db7d74fb110', + bidderRequestId: '16d438671bfbec', + bids: [ + { + bidder: 'synacormedia', + params: { + seatId: 'prebid', + placementId: 'demo1', + pos: 1, + video: {} + }, + renderer: { + url: '../syncOutstreamPlayer.js' + }, + mediaTypes: { + video: { + playerSize: [[300, 250]], + context: 'outstream' + } + }, + adUnitCode: 'div-1', + sizes: [[300, 250]], + bidId: '211c0236bb8f4e', + bidderRequestId: '16d438671bfbec', + auctionId: 'f8a75621-d672-4cbb-9275-3db7d74fb110', + src: 'client', + bidRequestsCount: 1, + bidderRequestsCount: 1, + bidderWinsCount: 0, + schain: { + ver: '1.0', + complete: 1, + nodes: [ + { + asi: 'indirectseller.com', + sid: '00001', + hp: 1 + } + ] + } + } + ], + auctionStart: 1580310345205, + timeout: 1000, + start: 1580310345211 + }; + + it('should return valid bid request with schain object', function () { + let req = spec.buildRequests([validBidReq], bidderRequest); + expect(req).to.have.property('method', 'POST'); + expect(req).to.have.property('url'); + expect(req.url).to.contain('//prebid.technoratimedia.com/openrtb/bids/prebid?src=$$REPO_AND_VERSION$$'); + expect(req.data).to.have.property('source'); + expect(req.data.source).to.have.property('ext'); + expect(req.data.source.ext).to.have.property('schain'); + }); + }); + describe('interpretResponse', function () { let bidResponse = { id: '10865933907263896~9998~0', From 793661c265184298d83d22117d6585a64c0cc7e2 Mon Sep 17 00:00:00 2001 From: Rajkumar Natarajan Date: Wed, 12 Feb 2020 13:10:33 -0500 Subject: [PATCH 2/2] fix build failure --- modules/synacormediaBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/synacormediaBidAdapter.js b/modules/synacormediaBidAdapter.js index 160385ab3aa..3412d2fd417 100644 --- a/modules/synacormediaBidAdapter.js +++ b/modules/synacormediaBidAdapter.js @@ -45,7 +45,7 @@ export const spec = { imp: [] }; - if (bidderRequest.bids && bidderRequest.bids[0]) { + if (bidderRequest.bids != undefined && bidderRequest.bids[0] != undefined) { const schain = bidderRequest.bids[0].schain; if (schain) { openRtbBidRequest.source = {};