Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ix Bid Adapter: add support for roundel alias #6473

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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