From db92bd67f15f3d3dde21214e4cefce8a44528a07 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Wed, 31 May 2017 11:43:31 -0400 Subject: [PATCH 1/2] Adding deal id to bid response --- src/adapters/prebidServer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/adapters/prebidServer.js b/src/adapters/prebidServer.js index dc83a04019b..e229da9b33f 100644 --- a/src/adapters/prebidServer.js +++ b/src/adapters/prebidServer.js @@ -154,6 +154,9 @@ function PrebidServer() { bidObject.ad = bidObj.adm; bidObject.width = bidObj.width; bidObject.height = bidObj.height; + if (bidObj.deal_id) { + bidObject.dealId = bidObj.deal_id; + } bidmanager.addBidResponse(bidObj.code, bidObject); }); From 16f5b7cf93acd3491c1db2c24f2658bf509896fb Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Wed, 31 May 2017 14:59:39 -0400 Subject: [PATCH 2/2] Added unit test for deal id --- test/spec/adapters/prebidServer_spec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/spec/adapters/prebidServer_spec.js b/test/spec/adapters/prebidServer_spec.js index 0d047133c97..abc3525a8f4 100644 --- a/test/spec/adapters/prebidServer_spec.js +++ b/test/spec/adapters/prebidServer_spec.js @@ -66,7 +66,8 @@ const RESPONSE = { 'price': 0.5, 'adm': '', 'width': 300, - 'height': 250 + 'height': 250, + 'deal_id': 'test-dealid' } ] }; @@ -218,5 +219,15 @@ describe('S2S Adapter', () => { const response = bidmanager.addBidResponse.firstCall.args[1]; expect(response).to.have.property('statusMessage', 'Bid returned empty or error response'); }); + + it('should have dealId in bidObject', () => { + server.respondWith(JSON.stringify(RESPONSE)); + + adapter.setConfig(CONFIG); + adapter.callBids(REQUEST); + server.respond(); + const response = bidmanager.addBidResponse.firstCall.args[1]; + expect(response).to.have.property('dealId', 'test-dealid'); + }); }); });