diff --git a/modules/trionBidAdapter.js b/modules/trionBidAdapter.js index c6de6fcbb2d..c2488bd351a 100644 --- a/modules/trionBidAdapter.js +++ b/modules/trionBidAdapter.js @@ -33,9 +33,10 @@ export const spec = { var bid = {}; var bidResponses = []; var bidRequest = request.bidRequest; + var responseBody = trionResponseObj ? trionResponseObj.body : {}; - if (trionResponseObj && trionResponseObj.bidId && bidRequest) { - var result = trionResponseObj.result; + if (responseBody && responseBody.bidId && bidRequest) { + var result = responseBody.result; if (result && result.cpm && result.placeBid && result.ad) { var cpm = parseInt(result.cpm, 10) / 100; @@ -45,6 +46,10 @@ export const spec = { bid.ad = result.ad; bid.width = result.width; bid.height = result.height; + bid.ttl = result.ttl; + bid.creativeId = result.creativeId; + bid.currency = result.currency; + bid.netRevenue = result.netRevenue; bidResponses.push(bid); } } diff --git a/test/spec/modules/trionBidAdapter_spec.js b/test/spec/modules/trionBidAdapter_spec.js index 77f6bf61616..559122a2772 100644 --- a/test/spec/modules/trionBidAdapter_spec.js +++ b/test/spec/modules/trionBidAdapter_spec.js @@ -127,7 +127,7 @@ describe('Trion adapter tests', () => { it('when place bid is returned as false', () => { TRION_BID_RESPONSE.result.placeBid = false; - let response = spec.interpretResponse(TRION_BID_RESPONSE, {bidRequest: TRION_BID}); + let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response).to.deep.equal([]); @@ -136,14 +136,14 @@ describe('Trion adapter tests', () => { it('when no cpm is in the response', () => { TRION_BID_RESPONSE.result.cpm = 0; - let response = spec.interpretResponse(TRION_BID_RESPONSE, {bidRequest: TRION_BID}); + let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response).to.deep.equal([]); TRION_BID_RESPONSE.result.cpm = 1; }); it('when no ad is in the response', () => { TRION_BID_RESPONSE.result.ad = null; - let response = spec.interpretResponse(TRION_BID_RESPONSE, {bidRequest: TRION_BID}); + let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response).to.deep.equal([]); TRION_BID_RESPONSE.result.ad = 'test'; }); @@ -153,7 +153,7 @@ describe('Trion adapter tests', () => { let bidHeight = '2'; TRION_BID_RESPONSE.result.width = bidWidth; TRION_BID_RESPONSE.result.height = bidHeight; - let response = spec.interpretResponse(TRION_BID_RESPONSE, {bidRequest: TRION_BID}); + let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response[0].width).to.equal(bidWidth); expect(response[0].height).to.equal(bidHeight); TRION_BID_RESPONSE.result.width = '300'; @@ -163,7 +163,7 @@ describe('Trion adapter tests', () => { it('cpm is properly set and transformed to cents', () => { let bidCpm = 2; TRION_BID_RESPONSE.result.cpm = bidCpm * 100; - let response = spec.interpretResponse(TRION_BID_RESPONSE, {bidRequest: TRION_BID}); + let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response[0].cpm).to.equal(bidCpm); TRION_BID_RESPONSE.result.cpm = 100; });