Repository: prebid/Prebid.js (JavaScript)

Issue:
BeOp adapter needs to use conventional currency location
## Type of issue
standards

## Description
Followup to https://github.com/prebid/Prebid.js/pull/7195

While reviewing the docs, I noticed that this adapter is asking for currency as a bidder-specific parameter and not looking in the standard location. (Being a reviewer is tough!)

@sebrobert , please submit a PR (with unit test)

You should be primarily asking the publisher for their currency as a bidder-specific param. See the [Currency module](https://docs.prebid.org/dev-docs/modules/currency.html) for the standard location for pubs to define their currency.

Instead of
```
  const publisherCurrency = utils.getValue(bid.params, 'currency') || 'EUR';
```
You should be doing something like this:
```
  const publisherCurrency = config.getConfig('currency.adServerCurrency') || utils.getValue(bid.params, 'currency') || 'EUR';
```
First look in the standard location, then it's ok to have a bidder-specific fall back param and an overall default.

Thanks.



Discussion:

Patch:
diff --git a/modules/beopBidAdapter.js b/modules/beopBidAdapter.js
index b7e6708f701..aed5d04a151 100644
--- a/modules/beopBidAdapter.js
+++ b/modules/beopBidAdapter.js
@@ -114,7 +114,7 @@ function buildTrackingParams(data, info, value) {
 
 function beOpRequestSlotsMaker(bid) {
   const bannerSizes = utils.deepAccess(bid, 'mediaTypes.banner.sizes');
-  const publisherCurrency = utils.getValue(bid.params, 'currency') || 'EUR';
+  const publisherCurrency = config.getConfig('currency.adServerCurrency') || utils.getValue(bid.params, 'currency') || 'EUR';
   let floor;
   if (typeof bid.getFloor === 'function') {
     const floorInfo = bid.getFloor({currency: publisherCurrency, mediaType: 'banner', size: [1, 1]});


Test patch:
diff --git a/test/spec/modules/beopBidAdapter_spec.js b/test/spec/modules/beopBidAdapter_spec.js
index 58296243a4a..b68adb8f196 100644
--- a/test/spec/modules/beopBidAdapter_spec.js
+++ b/test/spec/modules/beopBidAdapter_spec.js
@@ -1,6 +1,7 @@
 import { expect } from 'chai';
 import { spec } from 'modules/beopBidAdapter.js';
 import { newBidder } from 'src/adapters/bidderFactory.js';
+import { config } from 'src/config.js';
 const utils = require('src/utils');
 
 const ENDPOINT = 'https://hb.beop.io/bid';
@@ -16,6 +17,12 @@ let validBid = {
       'sizes': [[1, 1]]
     }
   },
+  'getFloor': () => {
+    return {
+      currency: 'USD',
+      floor: 10,
+    }
+  },
   'bidId': '30b31c1838de1e',
   'bidderRequestId': '22edbae2733bf6',
   'auctionId': '1d1a030790a475',
@@ -24,6 +31,10 @@ let validBid = {
 };
 
 describe('BeOp Bid Adapter tests', () => {
+  afterEach(function () {
+    config.setConfig({});
+  });
+
   const adapter = newBidder(spec);
 
   describe('inherited functions', () => {
@@ -81,6 +92,7 @@ describe('BeOp Bid Adapter tests', () => {
     bidRequests.push(validBid);
 
     it('should build the request', function () {
+      config.setConfig({'currency': {'adServerCurrency': 'USD'}});
       const request = spec.buildRequests(bidRequests, {});
       const payload = JSON.parse(request.data);
       const url = request.url;
@@ -89,6 +101,7 @@ describe('BeOp Bid Adapter tests', () => {
       expect(payload.pid).to.equal('5a8af500c9e77c00017e4cad');
       expect(payload.slts[0].name).to.exist;
       expect(payload.slts[0].name).to.equal('bellow-article');
+      expect(payload.slts[0].flr).to.equal(10);
     });
 
     it('should call the endpoint with GDPR consent and pageURL info if found', function () {