diff --git a/modules/brightMountainMediaBidAdapter.js b/modules/brightMountainMediaBidAdapter.js index 5539004bdcd..531238c7400 100644 --- a/modules/brightMountainMediaBidAdapter.js +++ b/modules/brightMountainMediaBidAdapter.js @@ -58,6 +58,7 @@ export const spec = { let placement = { placementId: bid.params.placement_id, bidId: bid.bidId, + floor: {}, }; if (bid.mediaTypes.hasOwnProperty(BANNER)) { @@ -87,6 +88,23 @@ export const spec = { placement['playbackmethod'] = bid.mediaTypes.video.playbackmethod; } } + + if (typeof bid.getFloor === 'function') { + let floorInfo = {}; + + for (let size of placement['sizes']) { + floorInfo = bid.getFloor({ + currency: 'USD', + mediaType: placement['traffic'], + size: size, + }); + + if (typeof floorInfo === 'object' && floorInfo.currency === 'USD') { + placement.floor[`${size[0]}x${size[1]}`] = parseFloat(floorInfo.floor); + } + } + } + if (bid.schain) { placement.schain = bid.schain; } @@ -105,10 +123,26 @@ export const spec = { if (response && Array.isArray(response) && response.length > 0) { for (let i = 0; i < response.length; i++) { if (response[i].cpm > 0) { + const tempResponse = { + requestId: response[i].requestId, + width: response[i].width, + height: response[i].height, + cpm: response[i].cpm, + mediaType: response[i].mediaType, + creativeId: response[i].creativeId, + currency: response[i].currency, + netRevenue: response[i].netRevenue, + ttl: response[i].ttl, + ad: response[i].ad, + meta: { + advertiserDomains: response[i].adomain && response[i].adomain.length ? response[i].adomain : [], + } + }; + if (response[i].mediaType && response[i].mediaType === 'video') { response[i].vastXml = response[i].ad; } - bidResponse.push(response[i]); + bidResponse.push(tempResponse); } } } diff --git a/test/spec/modules/brightMountainMediaBidAdapter_spec.js b/test/spec/modules/brightMountainMediaBidAdapter_spec.js index 6c7ef816f4f..17f23c5acd3 100644 --- a/test/spec/modules/brightMountainMediaBidAdapter_spec.js +++ b/test/spec/modules/brightMountainMediaBidAdapter_spec.js @@ -103,6 +103,48 @@ describe('brightMountainMediaBidAdapter_spec', function () { let serverRequest = spec.buildRequests([bidBanner], bidderRequest); testServerRequestBody(serverRequest); + it('sends bidfloor param if present', function () { + bidBanner.getFloor = function () { + return { + currency: 'USD', + floor: 0.5, + } + }; + const request = spec.buildRequests([bidBanner], bidderRequest); + expect(request.data.placements[0].floor['300x250']).to.equal(0.5); + }); + + it('sends gdpr info if exists', function () { + const gdprConsent = { + consentString: 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==', + gdprApplies: true + }; + + bidderRequest['gdprConsent'] = gdprConsent; + const request = spec.buildRequests([bidBanner], bidderRequest); + + expect(request.data.gdpr_require).to.exist.and.to.be.a('number'); + expect(request.data.gdpr_consent).to.exist.and.to.be.a('string'); + }); + + it('sends schain info if exists', function () { + const schain = { + ver: '1.0', + complete: 1, + nodes: [ + { + asi: 'directseller.com', + sid: '00001', + rid: 'BidRequest1', + hp: 1 + } + ] + }; + bidBanner.schain = schain; + const request = spec.buildRequests([bidBanner], bidderRequest); + expect(request.data.placements[0].schain).to.be.an('object'); + }); + bidderRequest['bids'] = [bidVideo]; serverRequest = spec.buildRequests([bidVideo], bidderRequest); testServerRequestBody(serverRequest); @@ -129,6 +171,7 @@ describe('brightMountainMediaBidAdapter_spec', function () { expect(dataItem.netRevenue).to.be.a('boolean'); expect(dataItem.currency).to.be.a('string'); expect(dataItem.mediaType).to.be.a('string'); + expect(dataItem.meta.advertiserDomains[0]).to.be.a('string'); } }); } @@ -145,7 +188,8 @@ describe('brightMountainMediaBidAdapter_spec', function () { ttl: 1000, creativeId: '123asd', netRevenue: true, - currency: 'USD' + currency: 'USD', + adomain: ['adomain.com'], }] }; @@ -160,7 +204,8 @@ describe('brightMountainMediaBidAdapter_spec', function () { ttl: 1000, creativeId: '123asd', netRevenue: true, - currency: 'USD' + currency: 'USD', + adomain: ['adomain.com'], }] }; let serverResponses = spec.interpretResponse(resObjectBanner);