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

GumGum Bid Adapter: pass bidfloor currency in bidrequest #6391

Merged
merged 21 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2f75c22
adds support for zone and pubId params
susyt Sep 10, 2020
d1aaf69
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Sep 11, 2020
02d0383
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Sep 24, 2020
919087e
adds support for iriscat field
susyt Sep 25, 2020
f1dcb6e
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Sep 25, 2020
a70d9ca
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Dec 1, 2020
2ac52c9
sets mediatype depending on product id
susyt Dec 1, 2020
7458a88
Update doc for mediaType needed for video products
susyt Dec 3, 2020
b08bca4
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Dec 7, 2020
569afc2
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Dec 9, 2020
28d4a0a
makes slot and invideo products avail for pubId
susyt Dec 9, 2020
e5892d1
updates gumgum doc
susyt Dec 9, 2020
0b86cfa
lint
susyt Dec 9, 2020
bcc1b9d
adds missing comma in gumgum doc
susyt Dec 15, 2020
8462752
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Feb 26, 2021
12f3d4e
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Mar 2, 2021
8d3a468
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Mar 4, 2021
8b4f56f
adds currency in ad request, adds unit test
susyt Mar 4, 2021
71c2ed8
Merge branch 'master' of https://github.com/prebid/Prebid.js
susyt Mar 5, 2021
b016c25
readd the previous irisid changes
susyt Mar 5, 2021
1359ea5
remove the only in testing
susyt Mar 5, 2021
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
24 changes: 12 additions & 12 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,25 +208,24 @@ function _getVidParams (attributes) {
* @param {Object} bid
* @returns {Number} floor
*/
function _getFloor (mediaTypes, bidfloor, bid) {
function _getFloor (mediaTypes, staticBidfloor, bid) {
const curMediaType = Object.keys(mediaTypes)[0] || 'banner';
let floor = bidfloor || 0;
const bidFloor = { floor: 0, currency: 'USD' };

if (typeof bid.getFloor === 'function') {
const floorInfo = bid.getFloor({
currency: 'USD',
const { currency, floor } = bid.getFloor({
mediaType: curMediaType,
size: '*'
});
floor && (bidFloor.floor = floor);
currency && (bidFloor.currency = currency);

if (typeof floorInfo === 'object' &&
floorInfo.currency === 'USD' &&
!isNaN(parseFloat(floorInfo.floor))) {
floor = Math.max(floor, parseFloat(floorInfo.floor));
if (staticBidfloor && floor && currency === 'USD') {
bidFloor.floor = Math.max(staticBidfloor, parseFloat(floor));
}
}

return floor;
return bidFloor;
}

/**
Expand All @@ -250,7 +249,7 @@ function buildRequests (validBidRequests, bidderRequest) {
transactionId,
userId = {}
} = bidRequest;
const bidFloor = _getFloor(mediaTypes, params.bidfloor, bidRequest);
const { currency, floor } = _getFloor(mediaTypes, params.bidfloor, bidRequest);
let sizes = [1, 1];
let data = {};

Expand All @@ -265,8 +264,9 @@ function buildRequests (validBidRequests, bidderRequest) {
data.pv = pageViewId;
}

if (bidFloor) {
data.fp = bidFloor;
if (floor) {
data.fp = floor;
data.fpc = currency;
}

if (params.iriscat && typeof params.iriscat === 'string') {
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ describe('gumgumAdapter', function () {
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data.fp).to.equal(bidfloor);
});
it('should return a floor currency', function () {
const request = spec.buildRequests(bidRequests)[0];
expect(request.data.fpc).to.equal(floorTestData.currency);
})
});

it('sends bid request to ENDPOINT via GET', function () {
Expand Down