Skip to content

Commit

Permalink
CCPA and Schain support (prebid#4537)
Browse files Browse the repository at this point in the history
* add video&native traffic colossus ssp

* Native obj validation

* Native obj validation #2

* Added size field in requests

* fixed test

* fix merge conflicts

* move to 3.0

* move to 3.0

* fix IE11 new URL issue

* fix IE11 new URL issue

* fix IE11 new URL issue

* https for 3.0

* add https test

* add ccp and schain features

* fix test

* sync with upstream, fix conflicts

* Update colossussspBidAdapter.js

remove commented code

* Update colossussspBidAdapter.js

lint fix
  • Loading branch information
Bill Newman authored and Isaac A. Dettman committed Dec 10, 2019
1 parent 1a1dd2f commit 2a5cfaa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
9 changes: 9 additions & 0 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export const spec = {
'placements': placements
};

if (bidderRequest) {
if (bidderRequest.uspConsent) {
request.ccpa = bidderRequest.uspConsent;
}
}

for (let i = 0; i < validBidRequests.length; i++) {
let bid = validBidRequests[i];
let traff = bid.params.traffic || BANNER
Expand All @@ -72,6 +78,9 @@ export const spec = {
sizes: bid.mediaTypes[traff].sizes,
traffic: traff
};
if (bid.schain) {
placement.schain = bid.schain;
}
placements.push(placement);
}
return {
Expand Down
41 changes: 37 additions & 4 deletions test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,36 @@ describe('ColossussspAdapter', function () {
sizes: [[300, 250]]
}
},
transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62'
transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62',
schain: {
ver: '1.0',
complete: 1,
nodes: [
{
asi: 'example.com',
sid: '0',
hp: 1,
rid: 'bidrequestid',
// name: 'alladsallthetime',
domain: 'example.com'
}
]
}
};
let bidderRequest = {
bidderCode: 'colossus',
auctionId: 'fffffff-ffff-ffff-ffff-ffffffffffff',
bidderRequestId: 'ffffffffffffff',
start: 1472239426002,
auctionStart: 1472239426000,
timeout: 5000,
uspConsent: '1YN-',
refererInfo: {
referer: 'http://www.example.com',
reachedTop: true,
},
bids: [bid]
}

describe('isBidRequestValid', function () {
it('Should return true when placement_id can be cast to a number', function () {
Expand All @@ -30,7 +58,7 @@ describe('ColossussspAdapter', function () {
});

describe('buildRequests', function () {
let serverRequest = spec.buildRequests([bid]);
let serverRequest = spec.buildRequests([bid], bidderRequest);
it('Creates a ServerRequest object with method, URL and data', function () {
expect(serverRequest).to.exist;
expect(serverRequest.method).to.exist;
Expand All @@ -43,10 +71,14 @@ describe('ColossussspAdapter', function () {
it('Returns valid URL', function () {
expect(serverRequest.url).to.equal('https://colossusssp.com/?c=o&m=multi');
});
it('Should contain ccpa', function() {
expect(serverRequest.data.ccpa).to.be.an('string')
})

it('Returns valid data if array of bids is valid', function () {
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements');
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa');
expect(data.deviceWidth).to.be.a('number');
expect(data.deviceHeight).to.be.a('number');
expect(data.language).to.be.a('string');
Expand All @@ -56,7 +88,8 @@ describe('ColossussspAdapter', function () {
let placements = data['placements'];
for (let i = 0; i < placements.length; i++) {
let placement = placements[i];
expect(placement).to.have.all.keys('placementId', 'bidId', 'traffic', 'sizes');
expect(placement).to.have.all.keys('placementId', 'bidId', 'traffic', 'sizes', 'schain');
expect(placement.schain).to.be.an('object')
expect(placement.placementId).to.be.a('number');
expect(placement.bidId).to.be.a('string');
expect(placement.traffic).to.be.a('string');
Expand Down

0 comments on commit 2a5cfaa

Please sign in to comment.