Skip to content

Commit

Permalink
Revert "Vidazoo Adapter: Feature/alternate-param-names (#5527)"
Browse files Browse the repository at this point in the history
This reverts commit 0403ba7.
  • Loading branch information
mkendall07 authored Jul 23, 2020
1 parent 61ba086 commit 432b4c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
20 changes: 2 additions & 18 deletions modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,16 @@ export function createDomain(subDomain = DEFAULT_SUB_DOMAIN) {
return `https://${subDomain}.cootlogix.com`;
}

export function extractCID(params) {
return params.cId || params.CID || params.cID || params.CId || params.cid || params.ciD || params.Cid || params.CiD;
}

export function extractPID(params) {
return params.pId || params.PID || params.pID || params.PId || params.pid || params.piD || params.Pid || params.PiD;
}

export function extractSubDomain(params) {
return params.subDomain || params.SubDomain || params.Subdomain || params.subdomain || params.SUBDOMAIN || params.subDOMAIN;
}

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

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

let data = {
url: encodeURIComponent(topWindowUrl),
Expand Down Expand Up @@ -85,7 +70,6 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
if (bidderRequest.uspConsent) {
data.usPrivacy = bidderRequest.uspConsent
}

const dto = {
method: 'POST',
url: `${createDomain(subDomain)}/prebid/multi/${cId}`,
Expand Down
24 changes: 2 additions & 22 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { spec as adapter, SUPPORTED_ID_SYSTEMS, createDomain, extractPID, extractCID, extractSubDomain } from 'modules/vidazooBidAdapter.js';
import { spec as adapter, SUPPORTED_ID_SYSTEMS, createDomain } from 'modules/vidazooBidAdapter.js';
import * as utils from 'src/utils.js';
import { version } from 'package.json';

Expand Down Expand Up @@ -220,7 +220,7 @@ describe('VidazooBidAdapter', function () {
});
});

describe('user id system', function () {
describe(`user id system`, function () {
Object.keys(SUPPORTED_ID_SYSTEMS).forEach((idSystemProvider) => {
const id = Date.now().toString();
const bid = utils.deepClone(BID);
Expand All @@ -243,24 +243,4 @@ describe('VidazooBidAdapter', function () {
});
});
});

describe('alternate param names extractors', function () {
it('should return undefined when param not supported', function () {
const cid = extractCID({ 'c_id': '1' });
const pid = extractPID({ 'p_id': '1' });
const subDomain = extractSubDomain({ 'sub_domain': 'prebid' });
expect(cid).to.be.undefined;
expect(pid).to.be.undefined;
expect(subDomain).to.be.undefined;
});

it('should return value when param supported', function () {
const cid = extractCID({ 'cID': '1' });
const pid = extractPID({ 'Pid': '2' });
const subDomain = extractSubDomain({ 'subDOMAIN': 'prebid' });
expect(cid).to.be.equal('1');
expect(pid).to.be.equal('2');
expect(subDomain).to.be.equal('prebid');
});
});
});

0 comments on commit 432b4c4

Please sign in to comment.