diff --git a/modules/playgroundxyzBidAdapter.js b/modules/playgroundxyzBidAdapter.js index e54f93ab8ca..f6a85b6522e 100644 --- a/modules/playgroundxyzBidAdapter.js +++ b/modules/playgroundxyzBidAdapter.js @@ -3,11 +3,11 @@ import { registerBidder } from 'src/adapters/bidderFactory'; import { BANNER } from 'src/mediaTypes'; const BIDDER_CODE = 'playgroundxyz'; -const URL = 'https://ads.playground.xyz/host-config/prebid'; +const URL = 'https://ads.playground.xyz/host-config/prebid?v=2'; export const spec = { code: BIDDER_CODE, - aliases: ['playgroundxyz'], + aliases: ['playgroundxyz', 'pxyz'], supportedMediaTypes: [BANNER], /** @@ -69,8 +69,10 @@ export const spec = { if (!serverResponse || serverResponse.error) { let errorMessage = `in response for ${bidderRequest.bidderCode} adapter`; - if (serverResponse && serverResponse.error) { errorMessage += `: ${serverResponse.error}`; } - utils.logError(errorMessage); + if (serverResponse && serverResponse.error) { + errorMessage += `: ${serverResponse.error}`; + utils.logError(errorMessage); + } return bids; } @@ -80,6 +82,10 @@ export const spec = { return bids; } + if (!serverResponse.seatbid) { + return bids; + } + serverResponse.seatbid.forEach(sBid => { if (sBid.hasOwnProperty('bid')) { sBid.bid.forEach(iBid => { @@ -131,6 +137,12 @@ function mapImpression(bid) { ext: { appnexus: { placement_id: parseInt(bid.params.placementId, 10) + }, + pxyz: { + adapter: { + vendor: 'prebid', + prebid: '$prebid.version$' + } } } }; diff --git a/test/spec/modules/playgroundxyzBidAdapter_spec.js b/test/spec/modules/playgroundxyzBidAdapter_spec.js index ac0922ef82e..92f88092e5d 100644 --- a/test/spec/modules/playgroundxyzBidAdapter_spec.js +++ b/test/spec/modules/playgroundxyzBidAdapter_spec.js @@ -3,7 +3,7 @@ import { spec } from 'modules/playgroundxyzBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; import { deepClone } from 'src/utils'; -const URL = 'https://ads.playground.xyz/host-config/prebid'; +const URL = 'https://ads.playground.xyz/host-config/prebid?v=2'; const GDPR_CONSENT = 'XYZ-CONSENT'; describe('playgroundxyzBidAdapter', function () { @@ -64,7 +64,7 @@ describe('playgroundxyzBidAdapter', function () { const data = JSON.parse(request.data); const banner = data.imp[0].banner; - expect(Object.keys(data.imp[0].ext)).to.have.members(['appnexus']); + expect(Object.keys(data.imp[0].ext)).to.have.members(['appnexus', 'pxyz']); expect([banner.w, banner.h]).to.deep.equal([300, 250]); expect(banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); expect(request.url).to.equal(URL); @@ -128,8 +128,8 @@ describe('playgroundxyzBidAdapter', function () { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', function () { - let response = ''; + it('handles nobid response', function () { + const response = undefined; let result = spec.interpretResponse({ body: response }, {bidderRequest}); expect(result.length).to.equal(0); });