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

VidoomyAdapter: add schain and bidfloor to vidoomy adapter #7965

Merged
merged 4 commits into from
Feb 9, 2022
Merged
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
8 changes: 8 additions & 0 deletions modules/vidoomyBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ const isBidRequestValid = bid => {
return false;
}

if (bid.params.bidfloor && (isNaN(bid.params.bidfloor) || bid.params.bidfloor < 0)) {
logError(BIDDER_CODE + ': bid.params.bidfloor should be a number equal or greater than zero');
return false;
}

return true;
};

Expand Down Expand Up @@ -77,6 +82,7 @@ const buildRequests = (validBidRequests, bidderRequest) => {
const hostname = aElement.hostname

const videoContext = deepAccess(bid, 'mediaTypes.video.context');
const bidfloor = deepAccess(bid, `params.bidfloor`, 0);

const queryParams = {
id: bid.params.id,
Expand All @@ -90,6 +96,8 @@ const buildRequests = (validBidRequests, bidderRequest) => {
dt: /Mobi/.test(navigator.userAgent) ? 2 : 1,
pid: bid.params.pid,
requestId: bid.bidId,
schain: bid.schain || '',
bidfloor,
d: getDomainWithoutSubdomain(hostname), // 'vidoomy.com',
sp: encodeURIComponent(aElement.href),
usp: bidderRequest.uspConsent || '',
Expand Down
6 changes: 4 additions & 2 deletions modules/vidoomyBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ var adUnits = [
bidder: 'vidoomy',
params: {
id: '123123',
pid: '123123'
pid: '123123',
bidfloor: 0.5 // This is optional
}
}
]
Expand All @@ -50,7 +51,8 @@ var adUnits = [
bidder: 'vidoomy',
params: {
id: '123123',
pid: '123123'
pid: '123123',
bidfloor: 0.5 // This is optional
}
}
]
Expand Down
8 changes: 7 additions & 1 deletion test/spec/modules/vidoomyBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ describe('vidoomyBidAdapter', function() {
'bidder': 'vidoomy',
'params': {
pid: '123123',
id: '123123'
id: '123123',
bidfloor: 0.5
},
'adUnitCode': 'code',
'sizes': [[300, 250]]
Expand All @@ -32,6 +33,11 @@ describe('vidoomyBidAdapter', function() {
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false when bidfloor is invalid', function () {
bid.params.bidfloor = 'not a number';
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false when id is empty', function () {
bid.params.id = '';
expect(spec.isBidRequestValid(bid)).to.equal(false);
Expand Down