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

Revert "Vidazoo Adapter: Feature/alternate-param-names" #5535

Merged
merged 1 commit into from
Jul 23, 2020
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
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');
});
});
});