Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented schain support for prebid and updated documentation examples for prebid3.0 #4844

Merged
merged 2 commits into from
Feb 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/synacormediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export const spec = {
},
imp: []
};

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

let seatId = null;

validBidReqs.forEach((bid, i) => {
Expand Down
8 changes: 5 additions & 3 deletions modules/synacormediaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
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 @@ -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',
Expand Down