diff --git a/modules/axonixBidAdapter.js b/modules/axonixBidAdapter.js index 224486467f3..daaac27e6a4 100644 --- a/modules/axonixBidAdapter.js +++ b/modules/axonixBidAdapter.js @@ -5,7 +5,7 @@ import * as utils from '../src/utils.js'; import { ajax } from '../src/ajax.js'; const BIDDER_CODE = 'axonix'; -const BIDDER_VERSION = '1.0.1'; +const BIDDER_VERSION = '1.0.2'; const CURRENCY = 'USD'; const DEFAULT_REGION = 'us-east-1'; @@ -140,15 +140,17 @@ export const spec = { }, interpretResponse: function(serverResponse) { - if (!utils.isArray(serverResponse)) { + const response = serverResponse ? serverResponse.body : []; + + if (!utils.isArray(response)) { return []; } const responses = []; - for (const response of serverResponse) { - if (response.requestId) { - responses.push(Object.assign(response, { + for (const resp of response) { + if (resp.requestId) { + responses.push(Object.assign(resp, { ttl: config.getConfig('_bidderTimeout') })); } @@ -171,15 +173,12 @@ export const spec = { } }, - onBidWon: function(bids) { - for (const bid of bids) { - const { nurl } = bid || {}; + onBidWon: function(bid) { + const { nurl } = bid || {}; - if (bid.nurl) { - utils.replaceAuctionPrice(nurl, bid.cpm) - utils.triggerPixel(nurl); - }; - } + if (bid.nurl) { + utils.triggerPixel(utils.replaceAuctionPrice(nurl, bid.cpm)); + }; } } diff --git a/modules/axonixBidAdapter.md b/modules/axonixBidAdapter.md index 1ff59f17828..7a4606d5502 100644 --- a/modules/axonixBidAdapter.md +++ b/modules/axonixBidAdapter.md @@ -3,7 +3,7 @@ ``` Module Name : Axonix Bidder Adapter Module Type : Bidder Adapter -Maintainer : support-prebid@axonix.com +Maintainer : support+prebid@axonix.com ``` # Description diff --git a/test/spec/modules/axonixBidAdapter_spec.js b/test/spec/modules/axonixBidAdapter_spec.js index aac1cbe08ff..a952d527600 100644 --- a/test/spec/modules/axonixBidAdapter_spec.js +++ b/test/spec/modules/axonixBidAdapter_spec.js @@ -71,47 +71,51 @@ describe('AxonixBidAdapter', function () { }; const BANNER_RESPONSE = { - requestId: 'f08b3a8dcff747eabada295dcf94eee0', - cpm: 6, - currency: 'USD', - width: 300, - height: 250, - ad: '', - creativeId: 'abc', - netRevenue: false, - meta: { - networkId: 'nid', - advertiserDomains: [ - 'https://the.url' - ], - secondaryCatIds: [ - 'IAB1' - ], - mediaType: 'banner' - }, - nurl: 'https://win.url' + body: [{ + requestId: 'f08b3a8dcff747eabada295dcf94eee0', + cpm: 6, + currency: 'USD', + width: 300, + height: 250, + ad: '', + creativeId: 'abc', + netRevenue: false, + meta: { + networkId: 'nid', + advertiserDomains: [ + 'https://the.url' + ], + secondaryCatIds: [ + 'IAB1' + ], + mediaType: 'banner' + }, + nurl: 'https://win.url' + }] }; const VIDEO_RESPONSE = { - requestId: 'f08b3a8dcff747eabada295dcf94eee0', - cpm: 6, - currency: 'USD', - width: 300, - height: 250, - ad: '', - creativeId: 'abc', - netRevenue: false, - meta: { - networkId: 'nid', - advertiserDomains: [ - 'https://the.url' - ], - secondaryCatIds: [ - 'IAB1' - ], - mediaType: 'video' - }, - nurl: 'https://win.url' + body: [{ + requestId: 'f08b3a8dcff747eabada295dcf94eee0', + cpm: 6, + currency: 'USD', + width: 300, + height: 250, + ad: '', + creativeId: 'abc', + netRevenue: false, + meta: { + networkId: 'nid', + advertiserDomains: [ + 'https://the.url' + ], + secondaryCatIds: [ + 'IAB1' + ], + mediaType: 'video' + }, + nurl: 'https://win.url' + }] }; describe('inherited functions', function () { @@ -311,21 +315,21 @@ describe('AxonixBidAdapter', function () { it('ignores unparseable responses', function() { expect(spec.interpretResponse('invalid')).to.be.an('array').that.is.empty; expect(spec.interpretResponse(['invalid'])).to.be.an('array').that.is.empty; - expect(spec.interpretResponse([{ invalid: 'object' }])).to.be.an('array').that.is.empty; + expect(spec.interpretResponse({ body: [{ invalid: 'object' }] })).to.be.an('array').that.is.empty; }); it('parses banner responses', function () { - const response = spec.interpretResponse([BANNER_RESPONSE]); + const response = spec.interpretResponse(BANNER_RESPONSE); expect(response).to.be.an('array').that.is.not.empty; - expect(response[0]).to.equal(BANNER_RESPONSE); + expect(response[0]).to.equal(BANNER_RESPONSE.body[0]); }); it('parses 1 video responses', function () { - const response = spec.interpretResponse([VIDEO_RESPONSE]); + const response = spec.interpretResponse(VIDEO_RESPONSE); expect(response).to.be.an('array').that.is.not.empty; - expect(response[0]).to.equal(VIDEO_RESPONSE); + expect(response[0]).to.equal(VIDEO_RESPONSE.body[0]); }); it.skip('parses 1 native responses', function () { @@ -346,17 +350,17 @@ describe('AxonixBidAdapter', function () { }); it('called once', function () { - spec.onBidWon(spec.interpretResponse([BANNER_RESPONSE])); + spec.onBidWon(BANNER_RESPONSE.body[0]); expect(utils.triggerPixel.calledOnce).to.equal(true); }); it('called false', function () { - spec.onBidWon([{ cpm: '2.21' }]); + spec.onBidWon({ cpm: '2.21' }); expect(utils.triggerPixel.called).to.equal(false); }); it('when there is no notification expected server side, none is called', function () { - var response = spec.onBidWon([]); + var response = spec.onBidWon({}); expect(utils.triggerPixel.called).to.equal(false); expect(response).to.be.an('undefined') }); @@ -364,11 +368,11 @@ describe('AxonixBidAdapter', function () { describe('onTimeout', function () { it('banner response', () => { - spec.onTimeout(spec.interpretResponse([BANNER_RESPONSE])); + spec.onTimeout(spec.interpretResponse(BANNER_RESPONSE)); }); it('video response', () => { - spec.onTimeout(spec.interpretResponse([VIDEO_RESPONSE])); + spec.onTimeout(spec.interpretResponse(VIDEO_RESPONSE)); }); }); });