Skip to content

Commit

Permalink
Smaato: Pass through bidRequest.schain
Browse files Browse the repository at this point in the history
  • Loading branch information
el-chuck committed Nov 3, 2021
1 parent 906e8c4 commit 3800bb8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/smaatoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {ADPOD, BANNER, VIDEO} from '../src/mediaTypes.js';

const BIDDER_CODE = 'smaato';
const SMAATO_ENDPOINT = 'https://prebid.ad.smaato.net/oapi/prebid';
const SMAATO_CLIENT = 'prebid_js_$prebid.version$_1.4'
const SMAATO_CLIENT = 'prebid_js_$prebid.version$_1.5'
const CURRENCY = 'USD';

const buildOpenRtbBidRequest = (bidRequest, bidderRequest) => {
Expand Down Expand Up @@ -37,6 +37,11 @@ const buildOpenRtbBidRequest = (bidRequest, bidderRequest) => {
user: {
ext: {}
},
source: {
ext: {
schain: bidRequest.schain
}
},
ext: {
client: SMAATO_CLIENT
}
Expand Down
29 changes: 29 additions & 0 deletions test/spec/modules/smaatoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ describe('smaatoBidAdapterTest', () => {
expect(req.regs.ext.us_privacy).to.equal('uspConsentString');
});

it('sends no schain if no schain exists', () => {
const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);

const req = extractPayloadOfFirstAndOnlyRequest(reqs);
expect(req.source.ext.schain).to.not.exist;
});

it('sends tmax', () => {
const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);

Expand Down Expand Up @@ -854,6 +861,28 @@ describe('smaatoBidAdapterTest', () => {
expect(req.user.ext.eids).to.have.length(2);
});
});

describe('schain in request', () => {
it('schain is added to source.ext.schain', () => {
const schain = {
ver: '1.0',
complete: 1,
nodes: [
{
'asi': 'asi',
'sid': 'sid',
'hp': 1
}
]
};
const bidRequestWithSchain = Object.assign({}, singleBannerBidRequest, {schain: schain});

const reqs = spec.buildRequests([bidRequestWithSchain], defaultBidderRequest);

const req = extractPayloadOfFirstAndOnlyRequest(reqs);
expect(req.source.ext.schain).to.deep.equal(schain);
});
});
});

describe('interpretResponse', () => {
Expand Down

0 comments on commit 3800bb8

Please sign in to comment.