From b083fe98f5a112cf10513ede4909b7cb58c8b844 Mon Sep 17 00:00:00 2001 From: Gabriel Chicoye Date: Thu, 10 Aug 2023 09:49:56 +0200 Subject: [PATCH] ad added --- modules/nexx360BidAdapter.js | 8 +++- test/spec/modules/nexx360BidAdapter_spec.js | 49 ++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/modules/nexx360BidAdapter.js b/modules/nexx360BidAdapter.js index 671cc800980..273f2290c68 100644 --- a/modules/nexx360BidAdapter.js +++ b/modules/nexx360BidAdapter.js @@ -192,7 +192,13 @@ function interpretResponse(serverResponse) { }; if (allowAlternateBidderCodes) response.bidderCode = `n360-${bid.ext.ssp}`; - if (bid.ext.mediaType === BANNER) response.adUrl = bid.ext.adUrl; + if (bid.ext.mediaType === BANNER) { + if (bid.adm) { + response.ad = bid.adm; + } else { + response.adUrl = bid.ext.adUrl; + } + } if ([INSTREAM, OUTSTREAM].includes(bid.ext.mediaType)) response.vastXml = bid.ext.vastXml; if (bid.ext.mediaType === OUTSTREAM) { diff --git a/test/spec/modules/nexx360BidAdapter_spec.js b/test/spec/modules/nexx360BidAdapter_spec.js index 7c2cea99a46..da4e6b414b0 100644 --- a/test/spec/modules/nexx360BidAdapter_spec.js +++ b/test/spec/modules/nexx360BidAdapter_spec.js @@ -434,7 +434,7 @@ describe('Nexx360 bid adapter tests', function () { const output = spec.interpretResponse(response); expect(output.length).to.be.eql(0); }); - it('banner responses', function() { + it('banner responses with adUrl only', function() { const response = { body: { 'id': 'a8d3a675-a4ba-4d26-807f-c8f2fad821e0', @@ -479,6 +479,53 @@ describe('Nexx360 bid adapter tests', function () { expect(output[0].currency).to.be.eql(response.body.cur); expect(output[0].cpm).to.be.eql(response.body.seatbid[0].bid[0].price); }); + it('banner responses with adm', function() { + const response = { + body: { + 'id': 'a8d3a675-a4ba-4d26-807f-c8f2fad821e0', + 'cur': 'USD', + 'seatbid': [ + { + 'bid': [ + { + 'id': '4427551302944024629', + 'impid': '226175918ebeda', + 'price': 1.5, + 'adomain': [ + 'http://prebid.org' + ], + 'crid': '98493581', + 'ssp': 'appnexus', + 'h': 600, + 'w': 300, + 'adm': '
TestAd
', + 'cat': [ + 'IAB3-1' + ], + 'ext': { + 'adUnitCode': 'div-1', + 'mediaType': 'banner', + 'adUrl': 'https://fast.nexx360.io/cache?uuid=fdddcebc-1edf-489d-880d-1418d8bdc493', + 'ssp': 'appnexus', + } + } + ], + 'seat': 'appnexus' + } + ], + 'ext': { + 'id': 'de3de7c7-e1cf-4712-80a9-94eb26bfc718', + 'cookies': [] + }, + } + }; + const output = spec.interpretResponse(response); + expect(output[0].ad).to.be.eql(response.body.seatbid[0].bid[0].adm); + expect(output[0].adUrl).to.be.eql(undefined); + expect(output[0].mediaType).to.be.eql(response.body.seatbid[0].bid[0].ext.mediaType); + expect(output[0].currency).to.be.eql(response.body.cur); + expect(output[0].cpm).to.be.eql(response.body.seatbid[0].bid[0].price); + }); it('instream responses', function() { const response = { body: {