Skip to content

Commit

Permalink
added support for roundel alias (prebid#6473)
Browse files Browse the repository at this point in the history
  • Loading branch information
lksharma authored and stsepelin committed May 28, 2021
1 parent 678e568 commit b3150ad
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import isInteger from 'core-js-pure/features/number/is-integer.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';

const BIDDER_CODE = 'ix';
const ALIAS_BIDDER_CODE = 'roundel';
const GLOBAL_VENDOR_ID = 10;
const SECURE_BID_URL = 'https://htlb.casalemedia.com/cygnus';
const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BANNER_ENDPOINT_VERSION = 7.2;
Expand Down Expand Up @@ -345,6 +347,12 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
}
}
}

// If `roundel` alias bidder, only send requests if liveramp ids exist.
if (bidderRequest && bidderRequest.bidderCode === ALIAS_BIDDER_CODE && !eidInfo.seenSources['liveramp.com']) {
return [];
}

const r = {};

// Since bidderRequestId are the same for different bid request, just use the first one.
Expand Down Expand Up @@ -697,7 +705,12 @@ function createMissingBannerImp(bid, imp, newSize) {
export const spec = {

code: BIDDER_CODE,
gvlid: 10,
gvlid: GLOBAL_VENDOR_ID,
aliases: [{
code: ALIAS_BIDDER_CODE,
gvlid: GLOBAL_VENDOR_ID,
skipPbsAliasing: false
}],
supportedMediaTypes: SUPPORTED_AD_TYPES,

/**
Expand Down
28 changes: 28 additions & 0 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,34 @@ describe('IndexexchangeAdapter', function () {
});
});

describe('Roundel alias adapter', function () {
const vaildBids = [DEFAULT_BANNER_VALID_BID, DEFAULT_VIDEO_VALID_BID, DEFAULT_MULTIFORMAT_BANNER_VALID_BID, DEFAULT_MULTIFORMAT_VIDEO_VALID_BID];
const ALIAS_OPTIONS = Object.assign({
bidderCode: 'roundel'
}, DEFAULT_OPTION);

it('should not build requests for mediaTypes if liveramp data is unavaliable', function () {
vaildBids.forEach((validBid) => {
const request = spec.buildRequests(validBid, ALIAS_OPTIONS);
expect(request).to.be.an('array');
expect(request).to.have.lengthOf(0);
});
});

it('should build requests for mediaTypes if liveramp data is avaliable', function () {
vaildBids.forEach((validBid) => {
const cloneValidBid = utils.deepClone(validBid);
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
const request = spec.buildRequests(cloneValidBid, ALIAS_OPTIONS);
const payload = JSON.parse(request[0].data.r);
expect(request).to.be.an('array');
expect(request).to.have.lengthOf(1);
expect(payload.user.eids).to.have.lengthOf(4);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
});
});
});

describe('buildRequestsIdentity', function () {
let request;
let query;
Expand Down

0 comments on commit b3150ad

Please sign in to comment.