Skip to content

Commit

Permalink
support rtbDomain seller end point
Browse files Browse the repository at this point in the history
  • Loading branch information
Inna Yaretsky authored and Inna Yaretsky committed Aug 2, 2022
1 parent 8e9318d commit 54e0d62
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 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://hb.${rtbDomain}/` : DEFAULT_SELLER_ENDPOINT;

This comment has been minimized.

Copy link
@noamtzu

noamtzu Aug 3, 2022

remove hb.

return testMode
? SELLER_ENDPOINT + MODES.TEST
: SELLER_ENDPOINT + MODES.PRODUCTION;
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://hb.${RTB_DOMAIN_TEST}/hb-multi`;

This comment has been minimized.

Copy link
@noamtzu

noamtzu Aug 3, 2022

same same

const RTB_DOMAIN_TEST_ENDPOINT = `https://hb.${RTB_DOMAIN_TEST}/hb-multi-test`;

This comment has been minimized.

Copy link
@noamtzu

noamtzu Aug 3, 2022

same same

const TTL = 360;
/* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */

Expand Down Expand Up @@ -119,6 +122,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 54e0d62

Please sign in to comment.