From 46b3ff4b49b17d643a1b0bb518a29262853e4692 Mon Sep 17 00:00:00 2001 From: Inna Yaretsky Date: Mon, 5 Jul 2021 14:35:35 +0300 Subject: [PATCH 1/4] 1. Added support for adomain 2. Get floor price from prebid --- modules/riseBidAdapter.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/riseBidAdapter.js b/modules/riseBidAdapter.js index a891e0aa883..0ba3ca4db1d 100644 --- a/modules/riseBidAdapter.js +++ b/modules/riseBidAdapter.js @@ -7,6 +7,7 @@ const SUPPORTED_AD_TYPES = [VIDEO]; const BIDDER_CODE = 'rise'; const BIDDER_VERSION = '4.0.0'; const TTL = 360; +const CURRENCY = 'USD'; const SELLER_ENDPOINT = 'https://hb.yellowblue.io/'; const MODES = { PRODUCTION: 'hb', @@ -53,6 +54,10 @@ export const spec = { mediaType: VIDEO }; + if (body.adomain && body.adomain.length) { + bidResponse.meta = {}; + bidResponse.meta.advertiserDomains = body.adomain + } bidResponses.push(bidResponse); return bidResponses; @@ -82,6 +87,23 @@ export const spec = { registerBidder(spec); +/** + * Get floor price + * @param bid {bid} + * @returns {Number} + */ +function getFloor(bid) { + if (!utils.isFn(bid.getFloor)) { + return 0; + } + let floorResult = bid.getFloor({ + currency: CURRENCY, + mediaType: VIDEO, + size: '*' + }); + return floorResult.currency === CURRENCY ? floorResult.floor : 0; +} + /** * Build the video request * @param bid {bid} @@ -206,7 +228,7 @@ function generateParameters(bid, bidderRequest) { width: width, height: height, publisher_id: params.org, - floor_price: params.floorPrice, + floor_price: Math.max(getFloor(bid), params.floorPrice), ua: navigator.userAgent, bid_id: utils.getBidIdParameter('bidId', bid), bidder_request_id: utils.getBidIdParameter('bidderRequestId', bid), From 6e2dcc9ff005f04c391538ed0dfda4422f9ac600 Mon Sep 17 00:00:00 2001 From: Inna Yaretsky Date: Mon, 5 Jul 2021 14:56:19 +0300 Subject: [PATCH 2/4] added adomain to interpretResponse test --- test/spec/modules/riseBidAdapter_spec.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/spec/modules/riseBidAdapter_spec.js b/test/spec/modules/riseBidAdapter_spec.js index 176437c4f27..057a7e0d12b 100644 --- a/test/spec/modules/riseBidAdapter_spec.js +++ b/test/spec/modules/riseBidAdapter_spec.js @@ -260,7 +260,8 @@ describe('riseAdapter', function () { height: 480, requestId: '21e12606d47ba7', netRevenue: true, - currency: 'USD' + currency: 'USD', + adomain: ['abc.com'] }; it('should get correct bid response', function () { @@ -275,7 +276,10 @@ describe('riseAdapter', function () { netRevenue: true, ttl: TTL, vastXml: '', - mediaType: VIDEO + mediaType: VIDEO, + meta: { + advertiserDomains: ['abc.com'] + } } ]; const result = spec.interpretResponse({ body: response }); From ae028b6ea1d9ae97927581f12fe6d71a49c20ff5 Mon Sep 17 00:00:00 2001 From: Inna Yaretsky Date: Tue, 6 Jul 2021 11:34:00 +0300 Subject: [PATCH 3/4] updated adapter version --- modules/riseBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/riseBidAdapter.js b/modules/riseBidAdapter.js index 0ba3ca4db1d..b03c5c15056 100644 --- a/modules/riseBidAdapter.js +++ b/modules/riseBidAdapter.js @@ -5,7 +5,7 @@ import {config} from '../src/config.js'; const SUPPORTED_AD_TYPES = [VIDEO]; const BIDDER_CODE = 'rise'; -const BIDDER_VERSION = '4.0.0'; +const BIDDER_VERSION = '4.0.1'; const TTL = 360; const CURRENCY = 'USD'; const SELLER_ENDPOINT = 'https://hb.yellowblue.io/'; From bcb12a97116b3e41750b3c6acbb94222aa2c29e8 Mon Sep 17 00:00:00 2001 From: Inna Yaretsky Date: Tue, 6 Jul 2021 14:38:56 +0300 Subject: [PATCH 4/4] added test for setting floor_price for bidRequest --- test/spec/modules/riseBidAdapter_spec.js | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/spec/modules/riseBidAdapter_spec.js b/test/spec/modules/riseBidAdapter_spec.js index 057a7e0d12b..b6c2f4fc61a 100644 --- a/test/spec/modules/riseBidAdapter_spec.js +++ b/test/spec/modules/riseBidAdapter_spec.js @@ -3,6 +3,7 @@ import { spec } from 'modules/riseBidAdapter.js'; import { newBidder } from 'src/adapters/bidderFactory.js'; import { config } from 'src/config.js'; import { VIDEO } from '../../../src/mediaTypes.js'; +import { deepClone } from 'src/utils.js'; const ENDPOINT = 'https://hb.yellowblue.io/hb'; const TEST_ENDPOINT = 'https://hb.yellowblue.io/hb-test'; @@ -250,6 +251,34 @@ describe('riseAdapter', function () { expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001,,,,'); } }); + + it('should set floor_price to getFloor.floor value if it is greater than params.floorPrice', function() { + const bid = deepClone(bidRequests[0]); + bid.getFloor = () => { + return { + currency: 'USD', + floor: 3.32 + } + } + bid.params.floorPrice = 0.64; + const request = spec.buildRequests([bid], bidderRequest)[0]; + expect(request.data).to.be.an('object'); + expect(request.data).to.have.property('floor_price', 3.32); + }); + + it('should set floor_price to params.floorPrice value if it is greater than getFloor.floor', function() { + const bid = deepClone(bidRequests[0]); + bid.getFloor = () => { + return { + currency: 'USD', + floor: 0.8 + } + } + bid.params.floorPrice = 1.5; + const request = spec.buildRequests([bid], bidderRequest)[0]; + expect(request.data).to.be.an('object'); + expect(request.data).to.have.property('floor_price', 1.5); + }); }); describe('interpretResponse', function () {