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

Tappx Bid Adapter: fix adtypes bug #7905

Merged
merged 6 commits into from
Jan 5, 2022
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
13 changes: 8 additions & 5 deletions modules/tappxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ export const spec = {
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: function(bid) {
return validBasic(bid) && validMediaType(bid)
// bid.params.host
if ((new RegExp(`^(vz.*|zz.*)\\.*$`, 'i')).test(bid.params.host)) { // New endpoint
if ((new RegExp(`^(zz.*)\\.*$`, 'i')).test(bid.params.host)) return validBasic(bid)
else return validBasic(bid) && validMediaType(bid)
} else { // This is backward compatible feature. It will be remove in the future
if ((new RegExp(`^(ZZ.*)\\.*$`, 'i')).test(bid.params.endpoint)) return validBasic(bid)
else return validBasic(bid) && validMediaType(bid)
}
},

/**
Expand Down Expand Up @@ -169,10 +176,6 @@ function validMediaType(bid) {
logWarn(LOG_PREFIX, 'Please review the mandatory Tappx parameters for Video. Video context not supported.');
return false;
}
if (typeof video.mimes == 'undefined') {
logWarn(LOG_PREFIX, 'Please review the mandatory Tappx parameters for Video. Mimes param is mandatory.');
return false;
}
}

return true;
Expand Down
19 changes: 0 additions & 19 deletions test/spec/modules/tappxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ describe('Tappx bid adapter', function () {
assert.isTrue(spec.isBidRequestValid(c_BIDREQUEST.bids[0]), JSON.stringify(c_BIDREQUEST));
});

it('should return false when params are missing', function () {
let badBidRequestParam = JSON.parse(JSON.stringify(c_BIDREQUEST));
delete badBidRequestParam.bids[0].params;
assert.isFalse(spec.isBidRequestValid(badBidRequestParam.bids[0]));
});

it('should return false when tappxkey is missing', function () {
let badBidRequestTpxkey = JSON.parse(JSON.stringify(c_BIDREQUEST)); ;
delete badBidRequestTpxkey.bids[0].params.tappxkey;
Expand All @@ -165,21 +159,11 @@ describe('Tappx bid adapter', function () {
assert.isTrue(spec.isBidRequestValid(badBidRequestNwEp.bids[0]));
});

it('should return false mimes param is missing', function () {
let badBidRequest_mimes = c_BIDDERREQUEST_V;
delete badBidRequest_mimes.bids.mediaTypes.video;
badBidRequest_mimes.bids.mediaTypes.video = {};
badBidRequest_mimes.bids.mediaTypes.video.context = 'instream';
badBidRequest_mimes.bids.mediaTypes.video.playerSize = [320, 250];
assert.isFalse(spec.isBidRequestValid(badBidRequest_mimes.bids), badBidRequest_mimes);
});

it('should return false for not instream/outstream requests', function () {
let badBidRequest_v = c_BIDDERREQUEST_V;
delete badBidRequest_v.bids.mediaTypes.banner;
badBidRequest_v.bids.mediaTypes.video = {};
badBidRequest_v.bids.mediaTypes.video.context = '';
badBidRequest_v.bids.mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
badBidRequest_v.bids.mediaTypes.video.playerSize = [320, 250];
assert.isFalse(spec.isBidRequestValid(badBidRequest_v.bids));
});
Expand Down Expand Up @@ -232,7 +216,6 @@ describe('Tappx bid adapter', function () {
validBidRequests_V[0].mediaTypes.video = {};
validBidRequests_V[0].mediaTypes.video.playerSize = [640, 480];
validBidRequests_V[0].mediaTypes.video.context = 'instream';
validBidRequests_V[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];

bidderRequest_V.bids.mediaTypes.context = 'instream';

Expand All @@ -252,7 +235,6 @@ describe('Tappx bid adapter', function () {
validBidRequests_Voutstream[0].mediaTypes.video = {};
validBidRequests_Voutstream[0].mediaTypes.video.playerSize = [640, 480];
validBidRequests_Voutstream[0].mediaTypes.video.context = 'outstream';
validBidRequests_Voutstream[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];

bidderRequest_VOutstream.bids.mediaTypes.context = 'outstream';

Expand All @@ -273,7 +255,6 @@ describe('Tappx bid adapter', function () {
validBidRequests_Voutstream[0].mediaTypes.video.rewarded = 1;
validBidRequests_Voutstream[0].mediaTypes.video.playerSize = [640, 480];
validBidRequests_Voutstream[0].mediaTypes.video.context = 'outstream';
validBidRequests_Voutstream[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];

bidderRequest_VOutstream.bids.mediaTypes.context = 'outstream';

Expand Down