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

Vidazoo Adapter: Feature/subdomain #5446

Merged
merged 10 commits into from
Jul 6, 2020
10 changes: 7 additions & 3 deletions modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js';

export const URL = 'https://prebid.cootlogix.com';
const DEFAULT_SUB_DOMAIN = 'prebid';
const BIDDER_CODE = 'vidazoo';
const CURRENCY = 'USD';
const TTL_SECONDS = 60 * 5;
Expand All @@ -27,14 +27,18 @@ export const SUPPORTED_ID_SYSTEMS = {
'tdid': 1,
};

export function createDomain(subDomain = DEFAULT_SUB_DOMAIN) {
return `https://${subDomain}.cootlogix.com`;
}

function isBidRequestValid(bid) {
const params = bid.params || {};
return !!(params.cId && params.pId);
}

function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
const { params, bidId, userId, adUnitCode } = bid;
const { bidFloor, cId, pId, ext } = params;
const { bidFloor, cId, pId, ext, subDomain } = params;
const hashUrl = hashCode(topWindowUrl);
const dealId = getNextDealId(hashUrl);

Expand Down Expand Up @@ -65,7 +69,7 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
}
const dto = {
method: 'POST',
url: `${URL}/prebid/multi/${cId}`,
url: `${createDomain(subDomain)}/prebid/multi/${cId}`,
data: data
};

Expand Down
7 changes: 5 additions & 2 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { expect } from 'chai';
import { spec as adapter, URL, SUPPORTED_ID_SYSTEMS } from 'modules/vidazooBidAdapter.js';
import { spec as adapter, SUPPORTED_ID_SYSTEMS, createDomain } from 'modules/vidazooBidAdapter.js';
import * as utils from 'src/utils.js';

const SUB_DOMAIN = 'openrtb';

const BID = {
'bidId': '2d52001cabd527',
'adUnitCode': 'div-gpt-ad-12345-0',
'params': {
'subDomain': SUB_DOMAIN,
'cId': '59db6b3b4ffaa70004f45cdc',
'pId': '59ac17c192832d0011283fe3',
'bidFloor': 0.1,
Expand Down Expand Up @@ -129,7 +132,7 @@ describe('VidazooBidAdapter', function () {
expect(requests).to.have.length(1);
expect(requests[0]).to.deep.equal({
method: 'POST',
url: `${URL}/prebid/multi/59db6b3b4ffaa70004f45cdc`,
url: `${createDomain(SUB_DOMAIN)}/prebid/multi/59db6b3b4ffaa70004f45cdc`,
uditalias marked this conversation as resolved.
Show resolved Hide resolved
data: {
gdprConsent: 'consent_string',
gdpr: 1,
Expand Down