Skip to content

Commit 27b57ab

Browse files
YakirLavinoamtzuberinoamtzuLaslo ChechurOronW
authored
Rise Bid Adapter : support currency (prebid#10790)
* add Rise adapter * fixes * change param isOrg to org * Rise adapter * change email for rise * fix circle failed * bump * bump * bump * remove space * Upgrade Rise adapter to 5.0 * added isWrapper param * addes is_wrapper parameter to documentation * added is_wrapper to test * removed isWrapper * Rise Bid Adapter: support Coppa param (#24) * MinuteMedia Bid Adapter: support Coppa param (#25) * Revert "MinuteMedia Bid Adapter: support Coppa param (#25)" (#26) This reverts commit 66c4e7b. * bump * update coppa fetch * setting coppa param update * update Coppa tests * update test naming * Rise Bid Adapter: support plcmt and sua (#27) * update minuteMediaBidAdapter - support missing params (#29) * RIseBidAdapter: support currency (#35) --------- Co-authored-by: Noam Tzuberi <[email protected]> Co-authored-by: noamtzu <[email protected]> Co-authored-by: Noam Tzuberi <[email protected]> Co-authored-by: Laslo Chechur <[email protected]> Co-authored-by: OronW <[email protected]> Co-authored-by: lasloche <[email protected]> Co-authored-by: inna <[email protected]> Co-authored-by: YakirLavi <[email protected]>
1 parent 4f3826a commit 27b57ab

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

modules/riseBidAdapter.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
1919
const BIDDER_CODE = 'rise';
2020
const ADAPTER_VERSION = '6.0.0';
2121
const TTL = 360;
22-
const CURRENCY = 'USD';
22+
const DEFAULT_CURRENCY = 'USD';
2323
const DEFAULT_SELLER_ENDPOINT = 'https://hb.yellowblue.io/';
2424
const MODES = {
2525
PRODUCTION: 'hb-multi',
@@ -73,7 +73,7 @@ export const spec = {
7373
const bidResponse = {
7474
requestId: adUnit.requestId,
7575
cpm: adUnit.cpm,
76-
currency: adUnit.currency || CURRENCY,
76+
currency: adUnit.currency || DEFAULT_CURRENCY,
7777
width: adUnit.width,
7878
height: adUnit.height,
7979
ttl: adUnit.ttl || TTL,
@@ -140,18 +140,20 @@ registerBidder(spec);
140140
/**
141141
* Get floor price
142142
* @param bid {bid}
143+
* @param mediaType {string}
144+
* @param currency {string}
143145
* @returns {Number}
144146
*/
145-
function getFloor(bid, mediaType) {
147+
function getFloor(bid, mediaType, currency) {
146148
if (!isFn(bid.getFloor)) {
147149
return 0;
148150
}
149151
let floorResult = bid.getFloor({
150-
currency: CURRENCY,
152+
currency: currency,
151153
mediaType: mediaType,
152154
size: '*'
153155
});
154-
return floorResult.currency === CURRENCY && floorResult.floor ? floorResult.floor : 0;
156+
return floorResult.currency === currency && floorResult.floor ? floorResult.floor : 0;
155157
}
156158

157159
/**
@@ -289,7 +291,7 @@ function generateBidParameters(bid, bidderRequest) {
289291
const {params} = bid;
290292
const mediaType = isBanner(bid) ? BANNER : VIDEO;
291293
const sizesArray = getSizesArray(bid, mediaType);
292-
294+
const currency = params.currency || config.getConfig('currency.adServerCurrency') || DEFAULT_CURRENCY;
293295
// fix floor price in case of NAN
294296
if (isNaN(params.floorPrice)) {
295297
params.floorPrice = 0;
@@ -299,12 +301,13 @@ function generateBidParameters(bid, bidderRequest) {
299301
mediaType,
300302
adUnitCode: getBidIdParameter('adUnitCode', bid),
301303
sizes: sizesArray,
302-
floorPrice: Math.max(getFloor(bid, mediaType), params.floorPrice),
304+
currency: currency,
305+
floorPrice: Math.max(getFloor(bid, mediaType, currency), params.floorPrice),
303306
bidId: getBidIdParameter('bidId', bid),
304307
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
305308
loop: getBidIdParameter('bidderRequestsCount', bid),
306309
transactionId: bid.ortb2Imp?.ext?.tid,
307-
coppa: 0
310+
coppa: 0,
308311
};
309312

310313
const pos = deepAccess(bid, `mediaTypes.${mediaType}.pos`);

modules/riseBidAdapter.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The adapter supports Video(instream).
2626
| `testMode` | optional | Boolean | This activates the test mode | false
2727
| `rtbDomain` | optional | String | Sets the seller end point | "www.test.com"
2828
| `is_wrapper` | private | Boolean | Please don't use unless your account manager asked you to | false
29+
| `currency` | optional | String | 3 letters currency | "EUR"
2930

3031

3132
# Test Parameters

test/spec/modules/riseBidAdapter_spec.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('riseAdapter', function () {
5353
'adUnitCode': 'adunit-code',
5454
'sizes': [[640, 480]],
5555
'params': {
56-
'org': 'jdye8weeyirk00000001'
56+
'org': 'jdye8weeyirk00000001',
5757
},
5858
'bidId': '299ffc8cca0b87',
5959
'loop': 1,
@@ -195,6 +195,16 @@ describe('riseAdapter', function () {
195195
expect(request.data.bids[1].mediaType).to.equal(BANNER)
196196
});
197197

198+
it('should send the correct currency in bid request', function () {
199+
const bid = utils.deepClone(bidRequests[0]);
200+
bid.params = {
201+
'currency': 'EUR'
202+
};
203+
const expectedCurrency = bid.params.currency;
204+
const request = spec.buildRequests([bid], bidderRequest);
205+
expect(request.data.bids[0].currency).to.equal(expectedCurrency);
206+
});
207+
198208
it('should respect syncEnabled option', function() {
199209
config.setConfig({
200210
userSync: {

0 commit comments

Comments
 (0)