Skip to content

Commit

Permalink
OpenWeb Bid Adapter : remove multi currency support (#11430)
Browse files Browse the repository at this point in the history
* removed currency from getFloor

* removed currency from generateBidParameters

* removed currency from optional params in md

* removed currency from test

---------

Co-authored-by: Dedi Sidi <[email protected]>
  • Loading branch information
IgorKulemzin and Dedis23 authored May 1, 2024
1 parent 0e58601 commit 670a859
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
10 changes: 4 additions & 6 deletions modules/openwebBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ registerBidder(spec);
* @param bid {bid}
* @returns {Number}
*/
function getFloor(bid, mediaType, currency) {
function getFloor(bid, mediaType) {
if (!isFn(bid.getFloor)) {
return 0;
}
let floorResult = bid.getFloor({
currency: currency,
currency: DEFAULT_CURRENCY,
mediaType: mediaType,
size: '*'
});
return floorResult.currency === currency && floorResult.floor ? floorResult.floor : 0;
return floorResult.currency === DEFAULT_CURRENCY && floorResult.floor ? floorResult.floor : 0;
}

/**
Expand Down Expand Up @@ -286,7 +286,6 @@ 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 @@ -297,8 +296,7 @@ function generateBidParameters(bid, bidderRequest) {
mediaType,
adUnitCode: getBidIdParameter('adUnitCode', bid),
sizes: sizesArray,
currency: currency,
floorPrice: Math.max(getFloor(bid, mediaType, currency), params.floorPrice),
floorPrice: Math.max(getFloor(bid, mediaType), params.floorPrice),
bidId: getBidIdParameter('bidId', bid),
loop: getBidIdParameter('bidderRequestsCount', bid),
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
Expand Down
4 changes: 1 addition & 3 deletions modules/openwebBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ The adapter supports Video and Display demand.
| `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 All @@ -50,4 +48,4 @@ var adUnits = [
}]
}
];
```
```
10 changes: 0 additions & 10 deletions test/spec/modules/openwebBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,6 @@ describe('openwebAdapter', 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 670a859

Please sign in to comment.