Skip to content

Commit

Permalink
Tappx Bid Adapter: fix adtypes bug (prebid#7905)
Browse files Browse the repository at this point in the history
* 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 <agrandes@tappx.com>
  • Loading branch information
2 people authored and matsumoto-kouichi committed Jan 20, 2022
1 parent 2e59681 commit dd58511
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
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

0 comments on commit dd58511

Please sign in to comment.