Skip to content

Commit

Permalink
ADTS-132 Use static bid floor if defined if getFloor module is not us…
Browse files Browse the repository at this point in the history
…ed by pub (#6974)
  • Loading branch information
lbenmore authored Jun 9, 2021
1 parent 86e86d7 commit 64586ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function _getVidParams (attributes) {
* @param {Object} bid
* @returns {Number} floor
*/
function _getFloor (mediaTypes, staticBidfloor, bid) {
function _getFloor (mediaTypes, staticBidFloor, bid) {
const curMediaType = Object.keys(mediaTypes)[0] || 'banner';
const bidFloor = { floor: 0, currency: 'USD' };

Expand All @@ -220,9 +220,11 @@ function _getFloor (mediaTypes, staticBidfloor, bid) {
floor && (bidFloor.floor = floor);
currency && (bidFloor.currency = currency);

if (staticBidfloor && floor && currency === 'USD') {
bidFloor.floor = Math.max(staticBidfloor, parseFloat(floor));
if (staticBidFloor && floor && currency === 'USD') {
bidFloor.floor = Math.max(staticBidFloor, parseFloat(floor));
}
} else if (staticBidFloor) {
bidFloor.floor = staticBidFloor
}

return bidFloor;
Expand Down
7 changes: 7 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ describe('gumgumAdapter', function () {
expect(bidRequest.gpid).to.equal(123456);
});

it('should set the bid floor if getFloor module is not present but static bid floor is defined', function () {
const req = { ...bidRequests[0], params: { bidfloor: 42 } }
const bidRequest = spec.buildRequests([req])[0];
expect(bidRequest.data).to.have.property('fp');
expect(bidRequest.data.fp).to.equal(42);
});

describe('product id', function () {
it('should set the correct pi param if native param is found', function () {
const request = { ...bidRequests[0], params: { ...zoneParam, native: 2 } };
Expand Down

0 comments on commit 64586ad

Please sign in to comment.