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

Colossus Bid Adapter: fix validator #7926

Merged
merged 69 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
b87237c
add video&native traffic colossus ssp
vladis-teqblaze Mar 26, 2018
1ca4e28
Native obj validation
vladis-teqblaze Apr 10, 2018
b5c1850
Native obj validation #2
vladis-teqblaze Apr 22, 2018
e969f27
Added size field in requests
vladis-teqblaze Apr 22, 2018
67693e1
fixed test
vladis-teqblaze Apr 22, 2018
e7ab418
fix merge conflicts
Nov 18, 2019
3320c68
fix merge conflicts
Nov 18, 2019
44e59b8
move to 3.0
Nov 18, 2019
7133a72
move to 3.0
Nov 18, 2019
3dba3ac
fix IE11 new URL issue
Nov 18, 2019
7f14e4d
fix IE11 new URL issue
Nov 18, 2019
78609ff
fix IE11 new URL issue
Nov 18, 2019
4c5d711
https for 3.0
Nov 20, 2019
1027b54
add https test
Nov 21, 2019
684639c
add ccp and schain features
Dec 5, 2019
1c6681c
fix test
Dec 5, 2019
436ff0f
sync with upstream, fix conflicts
Dec 5, 2019
2f9efee
sync with upstream, fix conflicts
Dec 5, 2019
c40dbe3
Update colossussspBidAdapter.js
Dec 9, 2019
7d2e9f3
Update colossussspBidAdapter.js
Dec 10, 2019
8055e57
Merge branch 'master' of https://github.com/prebid/Prebid.js
Feb 28, 2020
53bb18e
identity extensions
Feb 28, 2020
51faedc
identity extensions
Feb 28, 2020
6cee3e7
fix
Mar 6, 2020
461e4ff
fix
Mar 6, 2020
e78a9dc
fix
Mar 6, 2020
1547d0a
fix
Mar 6, 2020
803be44
fix
Mar 6, 2020
47a78af
add tests for user ids
Mar 10, 2020
9ff6f10
fix
Mar 10, 2020
b02455a
fix
Mar 10, 2020
a4b93a1
fix
Mar 10, 2020
1e74169
fix
Mar 10, 2020
74a42cd
fix
Mar 10, 2020
d65984e
fix
Mar 10, 2020
1595a00
fix
Mar 10, 2020
42c5e53
add gdpr support
Mar 10, 2020
480f127
add gdpr support
Mar 10, 2020
5d9299c
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 30, 2020
3a4c32c
Merge remote-tracking branch 'upstream/master'
Apr 14, 2020
a51a3e1
id5id support
Apr 16, 2020
562a1e5
Update colossussspBidAdapter.js
Jan 15, 2021
3a99998
Update colossussspBidAdapter.js
Jan 15, 2021
ffdefbd
Merge branch 'master' into master
Jan 15, 2021
0cb39f1
Update colossussspBidAdapter.js
Jan 15, 2021
38182c0
Update colossussspBidAdapter.js
Jan 15, 2021
d2b3331
Update colossussspBidAdapter.js
Jan 15, 2021
6e2a64b
Update colossussspBidAdapter_spec.js
Jan 15, 2021
32c71f2
Merge remote-tracking branch 'upstream/master'
Jan 20, 2021
f0c5c24
use floor module
Jan 20, 2021
586367d
Revert "use floor module"
Jan 20, 2021
4fa75dd
use floor module
Jan 20, 2021
4e16010
update to 5v
Aug 2, 2021
3f62aa0
fix conflicts
Aug 2, 2021
d8e9722
fix
Aug 2, 2021
00dd7a4
add uid2 and bidFloor support
Aug 29, 2021
bb93f94
fix
Aug 29, 2021
be17cfe
fix conflicts
Aug 29, 2021
58b1381
Merge remote-tracking branch 'prebid/master'
Sep 23, 2021
a30eff4
add pbadslot support
Sep 23, 2021
97f9e69
fix conflicts
Nov 25, 2021
3459b8d
fix conflicts
Nov 25, 2021
5597d45
add onBidWon
Nov 25, 2021
afdc2db
refactor
Nov 25, 2021
df5163b
add test for onBidWon()
Dec 1, 2021
7aa74cb
fix
Dec 1, 2021
b039e90
add group_id
Jan 5, 2022
d57e129
Trigger circleci
Jan 6, 2022
e63a8e3
fix
Jan 10, 2022
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
27 changes: 19 additions & 8 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getWindowTop, deepAccess, logMessage } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { ajax } from '../src/ajax.js';

const BIDDER_CODE = 'colossusssp';
const G_URL = 'https://colossusssp.com/?c=o&m=multi';
Expand Down Expand Up @@ -46,7 +47,10 @@ export const spec = {
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: (bid) => {
return Boolean(bid.bidId && bid.params && !isNaN(bid.params.placement_id));
const validPlacamentId = bid.params && !isNaN(bid.params.placement_id);
const validGroupId = bid.params && !isNaN(bid.params.group_id);

return Boolean(bid.bidId && (validPlacamentId || validGroupId));
},

/**
Expand All @@ -60,13 +64,13 @@ export const spec = {
const location = winTop.location;
let placements = [];
let request = {
'deviceWidth': winTop.screen.width,
'deviceHeight': winTop.screen.height,
'language': (navigator && navigator.language) ? navigator.language : '',
'secure': location.protocol === 'https:' ? 1 : 0,
'host': location.host,
'page': location.pathname,
'placements': placements,
deviceWidth: winTop.screen.width,
deviceHeight: winTop.screen.height,
language: (navigator && navigator.language) ? navigator.language : '',
secure: location.protocol === 'https:' ? 1 : 0,
host: location.host,
page: location.pathname,
placements: placements,
};

if (bidderRequest) {
Expand All @@ -84,6 +88,7 @@ export const spec = {
let traff = bid.params.traffic || BANNER
let placement = {
placementId: bid.params.placement_id,
groupId: bid.params.group_id,
bidId: bid.bidId,
sizes: bid.mediaTypes[traff].sizes,
traffic: traff,
Expand Down Expand Up @@ -175,6 +180,12 @@ export const spec = {
type: 'image',
url: G_URL_SYNC
}];
},

onBidWon: (bid) => {
if (bid.nurl) {
ajax(bid.nurl, null);
}
}
};

Expand Down
16 changes: 15 additions & 1 deletion modules/colossussspBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,19 @@ Module that connects to Colossus SSP demand sources
traffic: 'banner'
}
}]
];
}, {
code: 'placementid_1',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]]
}
},
bids: [{
bidder: 'colossusssp',
params: {
group_id: 0,
traffic: 'banner'
}
}]
}];
```
16 changes: 14 additions & 2 deletions test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ describe('ColossussspAdapter', function () {
bidder: 'colossusssp',
bidderRequestId: '145e1d6a7837c9',
params: {
placement_id: 0
placement_id: 0,
group_id: 0
},
placementCode: 'placementid_0',
auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2',
Expand Down Expand Up @@ -60,6 +61,7 @@ describe('ColossussspAdapter', function () {
});
it('Should return false when placement_id is not a number', function () {
bid.params.placement_id = 'aaa';
delete bid.params.group_id;
expect(spec.isBidRequestValid(bid)).to.be.false;
});
});
Expand Down Expand Up @@ -95,9 +97,10 @@ 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', 'eids', 'bidId', 'traffic', 'sizes', 'schain', 'floor', 'gpid');
expect(placement).to.have.all.keys('placementId', 'groupId', 'eids', 'bidId', 'traffic', 'sizes', 'schain', 'floor', 'gpid');
expect(placement.schain).to.be.an('object')
expect(placement.placementId).to.be.a('number');
expect(placement.groupId).to.be.a('number');
expect(placement.bidId).to.be.a('string');
expect(placement.traffic).to.be.a('string');
expect(placement.sizes).to.be.an('array');
Expand Down Expand Up @@ -186,6 +189,15 @@ describe('ColossussspAdapter', function () {
});
});

describe('onBidWon', function () {
it('should make an ajax call', function () {
const bid = {
nurl: 'http://example.com/win',
};
expect(spec.onBidWon(bid)).to.equals(undefined);
});
})

describe('getUserSyncs', function () {
let userSync = spec.getUserSyncs();
it('Returns valid URL and type', function () {
Expand Down