From 5289c297415d835449a17316c77f21b27a424563 Mon Sep 17 00:00:00 2001 From: inna Date: Thu, 11 Aug 2022 16:28:57 +0300 Subject: [PATCH] Rise bid adapter - support multi seller end points (#8771) * 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 * support rtbDomain seller end point * removed hb. from rtbDomain end point * added rtbDomain to docs Co-authored-by: Noam Tzuberi Co-authored-by: noamtzu Co-authored-by: Noam Tzuberi Co-authored-by: Laslo Chechur Co-authored-by: OronW <41260031+OronW@users.noreply.github.com> Co-authored-by: lasloche <62240785+lasloche@users.noreply.github.com> Co-authored-by: Inna Yaretsky --- modules/riseBidAdapter.js | 9 ++++++--- modules/riseBidAdapter.md | 4 +++- test/spec/modules/riseBidAdapter_spec.js | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/modules/riseBidAdapter.js b/modules/riseBidAdapter.js index 7d4049bf1a2..c1360b79066 100644 --- a/modules/riseBidAdapter.js +++ b/modules/riseBidAdapter.js @@ -8,7 +8,7 @@ const BIDDER_CODE = 'rise'; const ADAPTER_VERSION = '6.0.0'; const TTL = 360; const CURRENCY = 'USD'; -const SELLER_ENDPOINT = 'https://hb.yellowblue.io/'; +const DEFAULT_SELLER_ENDPOINT = 'https://hb.yellowblue.io/'; const MODES = { PRODUCTION: 'hb-multi', TEST: 'hb-multi-test' @@ -42,13 +42,14 @@ export const spec = { // use data from the first bid, to create the general params for all bids const generalObject = validBidRequests[0]; const testMode = generalObject.params.testMode; + const rtbDomain = generalObject.params.rtbDomain; combinedRequestsObject.params = generateGeneralParams(generalObject, bidderRequest); combinedRequestsObject.bids = generateBidsParams(validBidRequests, bidderRequest); return { method: 'POST', - url: getEndpoint(testMode), + url: getEndpoint(testMode, rtbDomain), data: combinedRequestsObject } }, @@ -223,9 +224,11 @@ function isSyncMethodAllowed(syncRule, bidderCode) { /** * Get the seller endpoint * @param testMode {boolean} + * @param rtbDomain {string} * @returns {string} */ -function getEndpoint(testMode) { +function getEndpoint(testMode, rtbDomain) { + const SELLER_ENDPOINT = rtbDomain ? `https://${rtbDomain}/` : DEFAULT_SELLER_ENDPOINT; return testMode ? SELLER_ENDPOINT + MODES.TEST : SELLER_ENDPOINT + MODES.PRODUCTION; diff --git a/modules/riseBidAdapter.md b/modules/riseBidAdapter.md index 83f8adfd645..2920fd28528 100644 --- a/modules/riseBidAdapter.md +++ b/modules/riseBidAdapter.md @@ -24,6 +24,7 @@ The adapter supports Video(instream). | `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 +| `rtbDomain` | optional | String | Sets the seller end point | "www.test.com" # Test Parameters ```javascript @@ -43,7 +44,8 @@ var adUnits = [ org: '56f91cd4d3e3660002000033', // Required floorPrice: 2.00, // Optional placementId: '12345678', // Optional - testMode: false // Optional + testMode: false // Optional, + rtbDomain: "www.test.com" //Optional } }] } diff --git a/test/spec/modules/riseBidAdapter_spec.js b/test/spec/modules/riseBidAdapter_spec.js index e3ef59e87ac..7daedb9015a 100644 --- a/test/spec/modules/riseBidAdapter_spec.js +++ b/test/spec/modules/riseBidAdapter_spec.js @@ -7,6 +7,9 @@ import * as utils from 'src/utils.js'; const ENDPOINT = 'https://hb.yellowblue.io/hb-multi'; const TEST_ENDPOINT = 'https://hb.yellowblue.io/hb-multi-test'; +const RTB_DOMAIN_TEST = 'testseller.com'; +const RTB_DOMAIN_ENDPOINT = `https://${RTB_DOMAIN_TEST}/hb-multi`; +const RTB_DOMAIN_TEST_ENDPOINT = `https://${RTB_DOMAIN_TEST}/hb-multi-test`; const TTL = 360; /* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */ @@ -122,6 +125,20 @@ describe('riseAdapter', function () { expect(request.method).to.equal('POST'); }); + it('sends bid request to rtbDomain ENDPOINT via POST', function () { + bidRequests[0].params.rtbDomain = RTB_DOMAIN_TEST; + const request = spec.buildRequests(bidRequests, bidderRequest); + expect(request.url).to.equal(RTB_DOMAIN_ENDPOINT); + expect(request.method).to.equal('POST'); + }); + + it('sends bid request to rtbDomain TEST ENDPOINT via POST', function () { + testModeBidRequests[0].params.rtbDomain = RTB_DOMAIN_TEST; + const request = spec.buildRequests(testModeBidRequests, bidderRequest); + expect(request.url).to.equal(RTB_DOMAIN_TEST_ENDPOINT); + expect(request.method).to.equal('POST'); + }); + it('should send the correct bid Id', function () { const request = spec.buildRequests(bidRequests, bidderRequest); expect(request.data.bids[0].bidId).to.equal('299ffc8cca0b87');