From ca432f568e5d0dd7f96af5f53a9392925d3721d8 Mon Sep 17 00:00:00 2001 From: prebidtappx <77485538+prebidtappx@users.noreply.github.com> Date: Wed, 5 Jan 2022 16:57:33 +0100 Subject: [PATCH] Tappx Bid Adapter: fix adtypes bug (#7905) * Tappx :: Adtypes bug :: solved * Tappx ::Mimes param is not mandatory now * Circle CI :: Aesthetic changes * Test hotfix :: Mimes is not mandatory now * Tappx :: Mimes is not longer mandatory * Tappx :: Remove mimes references. Is not mandatory Co-authored-by: Albert Grandes --- modules/tappxBidAdapter.js | 13 ++++++++----- test/spec/modules/tappxBidAdapter_spec.js | 19 ------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/modules/tappxBidAdapter.js b/modules/tappxBidAdapter.js index e2225156128..769e8f73565 100644 --- a/modules/tappxBidAdapter.js +++ b/modules/tappxBidAdapter.js @@ -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) + } }, /** @@ -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; diff --git a/test/spec/modules/tappxBidAdapter_spec.js b/test/spec/modules/tappxBidAdapter_spec.js index 49d739ed3be..8866670df77 100644 --- a/test/spec/modules/tappxBidAdapter_spec.js +++ b/test/spec/modules/tappxBidAdapter_spec.js @@ -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; @@ -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)); }); @@ -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'; @@ -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'; @@ -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';