From fed98c181230d725f32098a1c84185d1a0fc64b5 Mon Sep 17 00:00:00 2001 From: asurovenko-zeta <80847074+asurovenko-zeta@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:02:38 +0100 Subject: [PATCH] ZetaGlobalSsp: provide schain (#9678) Co-authored-by: Surovenko Alexey Co-authored-by: Alexey Surovenko --- modules/zeta_global_sspBidAdapter.js | 9 +++++++ .../modules/zeta_global_sspBidAdapter_spec.js | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/modules/zeta_global_sspBidAdapter.js b/modules/zeta_global_sspBidAdapter.js index 1ed35792285..2f392ccdbd3 100644 --- a/modules/zeta_global_sspBidAdapter.js +++ b/modules/zeta_global_sspBidAdapter.js @@ -146,6 +146,15 @@ export const spec = { deepSetValue(payload, 'regs.ext.us_privacy', bidderRequest.uspConsent); } + // schain + if (validBidRequests[0].schain) { + payload.source = { + ext: { + schain: validBidRequests[0].schain + } + } + } + if (bidderRequest?.timeout) { payload.tmax = bidderRequest.timeout; } diff --git a/test/spec/modules/zeta_global_sspBidAdapter_spec.js b/test/spec/modules/zeta_global_sspBidAdapter_spec.js index 3cec0d79fcb..4e18f49c849 100644 --- a/test/spec/modules/zeta_global_sspBidAdapter_spec.js +++ b/test/spec/modules/zeta_global_sspBidAdapter_spec.js @@ -25,6 +25,22 @@ describe('Zeta Ssp Bid Adapter', function () { } ]; + const schain = { + complete: 1, + nodes: [ + { + asi: 'asi1', + sid: 'sid1', + rid: 'rid1' + }, + { + asi: 'asi2', + sid: 'sid2', + rid: 'rid2' + } + ] + }; + const params = { user: { uid: 222, @@ -103,6 +119,7 @@ describe('Zeta Ssp Bid Adapter', function () { gdprApplies: 1, consentString: 'consentString' }, + schain: schain, uspConsent: 'someCCPAString', params: params, userIdAsEids: eids, @@ -372,4 +389,11 @@ describe('Zeta Ssp Bid Adapter', function () { expect(spec.onTimeout).to.exist.and.to.be.a('function'); expect(spec.onTimeout({ timeout: 1000 })).to.be.undefined; }); + + it('Test schain provided', function () { + const request = spec.buildRequests(bannerRequest, bannerRequest[0]); + const payload = JSON.parse(request.data); + + expect(payload.source.ext.schain).to.eql(schain); + }); });