Skip to content

Commit 645b562

Browse files
YakirLavinoamtzuberinoamtzuLaslo ChechurOronW
authored
MinuteMedia Bid Adapter : support currency (prebid#10791)
* 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) * add currency param to bid object and tests * update getFloor function and tests * adding test to currency param * adding doc & currency bidfloor support & update tests * update currency test * remove default test --------- 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 27b57ab commit 645b562

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

modules/minutemediaBidAdapter.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
1919
const BIDDER_CODE = 'minutemedia';
2020
const ADAPTER_VERSION = '6.0.0';
2121
const TTL = 360;
22-
const CURRENCY = 'USD';
22+
const DEFAULT_CURRENCY = 'USD';
2323
const SELLER_ENDPOINT = 'https://hb.minutemedia-prebid.com/';
2424
const MODES = {
2525
PRODUCTION: 'hb-mm-multi',
@@ -72,7 +72,7 @@ export const spec = {
7272
const bidResponse = {
7373
requestId: adUnit.requestId,
7474
cpm: adUnit.cpm,
75-
currency: adUnit.currency || CURRENCY,
75+
currency: adUnit.currency || DEFAULT_CURRENCY,
7676
width: adUnit.width,
7777
height: adUnit.height,
7878
ttl: adUnit.ttl || TTL,
@@ -141,16 +141,16 @@ registerBidder(spec);
141141
* @param bid {bid}
142142
* @returns {Number}
143143
*/
144-
function getFloor(bid, mediaType) {
144+
function getFloor(bid, mediaType, currency) {
145145
if (!isFn(bid.getFloor)) {
146146
return 0;
147147
}
148148
let floorResult = bid.getFloor({
149-
currency: CURRENCY,
149+
currency: currency,
150150
mediaType: mediaType,
151151
size: '*'
152152
});
153-
return floorResult.currency === CURRENCY && floorResult.floor ? floorResult.floor : 0;
153+
return floorResult.currency === currency && floorResult.floor ? floorResult.floor : 0;
154154
}
155155

156156
/**
@@ -286,6 +286,7 @@ function generateBidParameters(bid, bidderRequest) {
286286
const {params} = bid;
287287
const mediaType = isBanner(bid) ? BANNER : VIDEO;
288288
const sizesArray = getSizesArray(bid, mediaType);
289+
const currency = params.currency || config.getConfig('currency.adServerCurrency') || DEFAULT_CURRENCY;
289290

290291
// fix floor price in case of NAN
291292
if (isNaN(params.floorPrice)) {
@@ -296,12 +297,13 @@ function generateBidParameters(bid, bidderRequest) {
296297
mediaType,
297298
adUnitCode: getBidIdParameter('adUnitCode', bid),
298299
sizes: sizesArray,
299-
floorPrice: Math.max(getFloor(bid, mediaType), params.floorPrice),
300+
currency: currency,
301+
floorPrice: Math.max(getFloor(bid, mediaType, currency), params.floorPrice),
300302
bidId: getBidIdParameter('bidId', bid),
301303
loop: getBidIdParameter('bidderRequestsCount', bid),
302304
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
303305
transactionId: bid.ortb2Imp?.ext?.tid || '',
304-
coppa: 0
306+
coppa: 0,
305307
};
306308

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

modules/minutemediaBidAdapter.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The adapter supports Video(instream) & Banner.
2424
| `floorPrice` | optional | Number | Minimum price in USD. Misuse of this parameter can impact revenue | 2.00
2525
| `placementId` | optional | String | A unique placement identifier | "12345678"
2626
| `testMode` | optional | Boolean | This activates the test mode | false
27+
| `currency` | optional | String | 3 letters currency | "EUR"
2728

2829
# Test Parameters
2930
```javascript

test/spec/modules/minutemediaBidAdapter_spec.js

+10
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ describe('minutemediaAdapter', function () {
178178
expect(request.data.bids[1].mediaType).to.equal(BANNER)
179179
});
180180

181+
it('should send the correct currency in bid request', function () {
182+
const bid = utils.deepClone(bidRequests[0]);
183+
bid.params = {
184+
'currency': 'EUR'
185+
};
186+
const expectedCurrency = bid.params.currency;
187+
const request = spec.buildRequests([bid], bidderRequest);
188+
expect(request.data.bids[0].currency).to.equal(expectedCurrency);
189+
});
190+
181191
it('should respect syncEnabled option', function() {
182192
config.setConfig({
183193
userSync: {

0 commit comments

Comments
 (0)