Skip to content

Commit 27c3ad3

Browse files
el-chuckChris Pabst
authored and
Chris Pabst
committed
Smaato: Pass through bidRequest.schain (prebid#7675)
Co-authored-by: Bernhard Pickenbrock <[email protected]>
1 parent 22ee9e7 commit 27c3ad3

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

modules/smaatoBidAdapter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {ADPOD, BANNER, VIDEO} from '../src/mediaTypes.js';
55

66
const BIDDER_CODE = 'smaato';
77
const SMAATO_ENDPOINT = 'https://prebid.ad.smaato.net/oapi/prebid';
8-
const SMAATO_CLIENT = 'prebid_js_$prebid.version$_1.4'
8+
const SMAATO_CLIENT = 'prebid_js_$prebid.version$_1.5'
99
const CURRENCY = 'USD';
1010

1111
const buildOpenRtbBidRequest = (bidRequest, bidderRequest) => {
@@ -37,6 +37,11 @@ const buildOpenRtbBidRequest = (bidRequest, bidderRequest) => {
3737
user: {
3838
ext: {}
3939
},
40+
source: {
41+
ext: {
42+
schain: bidRequest.schain
43+
}
44+
},
4045
ext: {
4146
client: SMAATO_CLIENT
4247
}

test/spec/modules/smaatoBidAdapter_spec.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ describe('smaatoBidAdapterTest', () => {
287287
expect(req.regs.ext.us_privacy).to.equal('uspConsentString');
288288
});
289289

290+
it('sends no schain if no schain exists', () => {
291+
const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);
292+
293+
const req = extractPayloadOfFirstAndOnlyRequest(reqs);
294+
expect(req.source.ext.schain).to.not.exist;
295+
});
296+
290297
it('sends tmax', () => {
291298
const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);
292299

@@ -854,6 +861,29 @@ describe('smaatoBidAdapterTest', () => {
854861
expect(req.user.ext.eids).to.have.length(2);
855862
});
856863
});
864+
865+
describe('schain in request', () => {
866+
it('schain is added to source.ext.schain', () => {
867+
const schain = {
868+
ver: '1.0',
869+
complete: 1,
870+
nodes: [
871+
{
872+
'asi': 'asi',
873+
'sid': 'sid',
874+
'rid': 'rid',
875+
'hp': 1
876+
}
877+
]
878+
};
879+
const bidRequestWithSchain = Object.assign({}, singleBannerBidRequest, {schain: schain});
880+
881+
const reqs = spec.buildRequests([bidRequestWithSchain], defaultBidderRequest);
882+
883+
const req = extractPayloadOfFirstAndOnlyRequest(reqs);
884+
expect(req.source.ext.schain).to.deep.equal(schain);
885+
});
886+
});
857887
});
858888

859889
describe('interpretResponse', () => {

0 commit comments

Comments
 (0)