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

ConcertBidApater: Add schain support #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions modules/concertBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const spec = {
gdprConsent: bidderRequest.gdprConsent,
gppConsent: bidderRequest.gppConsent,
tdid: getTdid(bidderRequest, validBidRequests),
schain: getSchain(validBidRequests),
}
};

Expand Down Expand Up @@ -279,3 +280,7 @@ function getTdid(bidderRequest, validBidRequests) {

return deepAccess(validBidRequests[0], 'userId.tdid') || null;
}

function getSchain(validBidRequests) {
return deepAccess(validBidRequests[0], 'schain') || null;
}
25 changes: 25 additions & 0 deletions test/spec/modules/concertBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,31 @@ describe('ConcertAdapter', function () {
const payload = JSON.parse(request.data);
expect(payload.meta.tdid).to.equal(tdid);
});

it('should return null if schain object is not present', function () {
const request = spec.buildRequests(bidRequests, bidRequest);
const payload = JSON.parse(request.data);
expect(payload.meta.schain).to.be.null;
});

it('should pass along schain object if present', function () {
const schain = {
ver: "1.0",
complete: 1,
nodes: [
{
asi: "directseller.com",
sid: "00001",
rid: "BidRequest1",
hp: 1,
},
],
};
const bidRequestsWithSchain = [{ ...bidRequests[0], schain }]
const request = spec.buildRequests(bidRequestsWithSchain, bidRequest);
const payload = JSON.parse(request.data);
expect(payload.meta.schain).to.deep.equal(schain);
});
});

describe('spec.interpretResponse', function() {
Expand Down