Skip to content

Commit

Permalink
Rise bid adapter - support multi seller end points (#8771)
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

* support rtbDomain seller end point

* removed hb. from rtbDomain end point

* added rtbDomain to docs

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 Yaretsky <[email protected]>
  • Loading branch information
8 people authored Aug 11, 2022
1 parent 0509631 commit 5289c29
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
9 changes: 6 additions & 3 deletions modules/riseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
}
},
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion modules/riseBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}]
}
Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/riseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }] */

Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 5289c29

Please sign in to comment.