Skip to content

Commit

Permalink
Merge pull request prebid#14 in SA/prebid from CAP-1636 to master
Browse files Browse the repository at this point in the history
* commit 'b6dfbc9a938563c2964d30719a78cde1f15d3740':
  CAP-1636 support schain object in prebid
  • Loading branch information
Rajkumar Natarajan committed Feb 7, 2020
2 parents f430418 + b6dfbc9 commit d6932f3
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/synacormediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ export const spec = {
},
imp: []
};

if (bidderRequest !== undefined && bidderRequest.bids !== undefined && bidderRequest.bids[0] !== undefined) {
const schain = bidderRequest.bids[0].schain;
if (schain !== undefined) {
openRtbBidRequest.source = {};
openRtbBidRequest.source.ext = { schain };
}
}

let seatId = null;
validBidReqs.forEach((bid, i) => {
if (seatId && seatId !== bid.params.seatId) {
Expand Down
92 changes: 92 additions & 0 deletions test/spec/modules/synacormediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,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',
Expand Down

0 comments on commit d6932f3

Please sign in to comment.