Skip to content

Commit

Permalink
MinuteMedia Bid Adapter : support currency (#10791)
Browse files Browse the repository at this point in the history
* 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 <noam.tzuberi@ironsrc.com>
Co-authored-by: noamtzu <noamtzu@gmail.com>
Co-authored-by: Noam Tzuberi <noamtzu@users.noreply.github.com>
Co-authored-by: Laslo Chechur <laslo.chechur@ironsrc.com>
Co-authored-by: OronW <41260031+OronW@users.noreply.github.com>
Co-authored-by: lasloche <62240785+lasloche@users.noreply.github.com>
Co-authored-by: inna <innayare@gmail.com>
Co-authored-by: YakirLavi <yakir.lavi@risecodes.com>
  • Loading branch information
9 people committed Dec 5, 2023
1 parent 27b57ab commit 645b562
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
16 changes: 9 additions & 7 deletions modules/minutemediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BIDDER_CODE = 'minutemedia';
const ADAPTER_VERSION = '6.0.0';
const TTL = 360;
const CURRENCY = 'USD';
const DEFAULT_CURRENCY = 'USD';
const SELLER_ENDPOINT = 'https://hb.minutemedia-prebid.com/';
const MODES = {
PRODUCTION: 'hb-mm-multi',
Expand Down Expand Up @@ -72,7 +72,7 @@ export const spec = {
const bidResponse = {
requestId: adUnit.requestId,
cpm: adUnit.cpm,
currency: adUnit.currency || CURRENCY,
currency: adUnit.currency || DEFAULT_CURRENCY,
width: adUnit.width,
height: adUnit.height,
ttl: adUnit.ttl || TTL,
Expand Down Expand Up @@ -141,16 +141,16 @@ registerBidder(spec);
* @param bid {bid}
* @returns {Number}
*/
function getFloor(bid, mediaType) {
function getFloor(bid, mediaType, currency) {
if (!isFn(bid.getFloor)) {
return 0;
}
let floorResult = bid.getFloor({
currency: CURRENCY,
currency: currency,
mediaType: mediaType,
size: '*'
});
return floorResult.currency === CURRENCY && floorResult.floor ? floorResult.floor : 0;
return floorResult.currency === currency && floorResult.floor ? floorResult.floor : 0;
}

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

// fix floor price in case of NAN
if (isNaN(params.floorPrice)) {
Expand All @@ -296,12 +297,13 @@ function generateBidParameters(bid, bidderRequest) {
mediaType,
adUnitCode: getBidIdParameter('adUnitCode', bid),
sizes: sizesArray,
floorPrice: Math.max(getFloor(bid, mediaType), params.floorPrice),
currency: currency,
floorPrice: Math.max(getFloor(bid, mediaType, currency), params.floorPrice),
bidId: getBidIdParameter('bidId', bid),
loop: getBidIdParameter('bidderRequestsCount', bid),
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
transactionId: bid.ortb2Imp?.ext?.tid || '',
coppa: 0
coppa: 0,
};

const pos = deepAccess(bid, `mediaTypes.${mediaType}.pos`);
Expand Down
1 change: 1 addition & 0 deletions modules/minutemediaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The adapter supports Video(instream) & Banner.
| `floorPrice` | optional | Number | Minimum price in USD. Misuse of this parameter can impact revenue | 2.00
| `placementId` | optional | String | A unique placement identifier | "12345678"
| `testMode` | optional | Boolean | This activates the test mode | false
| `currency` | optional | String | 3 letters currency | "EUR"

# Test Parameters
```javascript
Expand Down
10 changes: 10 additions & 0 deletions test/spec/modules/minutemediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ describe('minutemediaAdapter', function () {
expect(request.data.bids[1].mediaType).to.equal(BANNER)
});

it('should send the correct currency in bid request', function () {
const bid = utils.deepClone(bidRequests[0]);
bid.params = {
'currency': 'EUR'
};
const expectedCurrency = bid.params.currency;
const request = spec.buildRequests([bid], bidderRequest);
expect(request.data.bids[0].currency).to.equal(expectedCurrency);
});

it('should respect syncEnabled option', function() {
config.setConfig({
userSync: {
Expand Down

0 comments on commit 645b562

Please sign in to comment.