From 23166534a16befd9a8faec0de81d16eb813c1780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Dur=C3=A1n?= Date: Tue, 1 Oct 2019 17:03:42 -0700 Subject: [PATCH 1/2] Add support for supply chain object module Story: [#168742394](https://www.pivotaltracker.com/story/show/168742394) Co-authored-by: Josh Becker --- modules/sharethroughBidAdapter.js | 4 +++ .../modules/sharethroughBidAdapter_spec.js | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/modules/sharethroughBidAdapter.js b/modules/sharethroughBidAdapter.js index 7fe41b2b7ae..693d42ca57b 100644 --- a/modules/sharethroughBidAdapter.js +++ b/modules/sharethroughBidAdapter.js @@ -41,6 +41,10 @@ export const sharethroughAdapterSpec = { query.ttduid = bidRequest.userId.tdid; } + if (bidRequest.schain) { + query.schain = JSON.stringify(bidRequest.schain); + } + // Data that does not need to go to the server, // but we need as part of interpretResponse() const strData = { diff --git a/test/spec/modules/sharethroughBidAdapter_spec.js b/test/spec/modules/sharethroughBidAdapter_spec.js index afa5f44959c..02e76900e8d 100644 --- a/test/spec/modules/sharethroughBidAdapter_spec.js +++ b/test/spec/modules/sharethroughBidAdapter_spec.js @@ -280,6 +280,31 @@ describe('sharethrough adapter spec', function () { } }); }); + + it('should add a supply chain parameter if schain is present', function() { + // shallow copy of the first bidRequest obj, so we don't mutate + const bidRequest = Object.assign({}, bidRequests[0]); + bidRequest['schain'] = { + ver: '1.0', + complete: 1, + nodes: [ + { + asi: 'directseller.com', + sid: '00001', + rid: 'BidRequest1', + hp: 1 + } + ] + }; + + const builtBidRequest = spec.buildRequests([bidRequest])[0]; + expect(builtBidRequest.data.schain).to.eq(JSON.stringify(bidRequest.schain)); + }); + + it('should not add a supply chain parameter if schain is missing', function() { + const bidRequest = spec.buildRequests(bidRequests)[0]; + expect(bidRequest.data).to.not.include.any.keys('schain'); + }); }); describe('.interpretResponse', function () { From 37a96d5f6e7274b4225060877915704f7e033444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Dur=C3=A1n?= Date: Thu, 3 Oct 2019 15:43:38 -0700 Subject: [PATCH 2/2] Add bidfloor parameter to bid request sent to STX Story: [#168742573](https://www.pivotaltracker.com/story/show/168742573) --- modules/sharethroughBidAdapter.js | 4 ++++ test/spec/modules/sharethroughBidAdapter_spec.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/modules/sharethroughBidAdapter.js b/modules/sharethroughBidAdapter.js index 693d42ca57b..117088f5355 100644 --- a/modules/sharethroughBidAdapter.js +++ b/modules/sharethroughBidAdapter.js @@ -45,6 +45,10 @@ export const sharethroughAdapterSpec = { query.schain = JSON.stringify(bidRequest.schain); } + if (bidRequest.bidfloor) { + query.bidfloor = parseFloat(bidRequest.bidfloor); + } + // Data that does not need to go to the server, // but we need as part of interpretResponse() const strData = { diff --git a/test/spec/modules/sharethroughBidAdapter_spec.js b/test/spec/modules/sharethroughBidAdapter_spec.js index 02e76900e8d..8a8ccdbbeb3 100644 --- a/test/spec/modules/sharethroughBidAdapter_spec.js +++ b/test/spec/modules/sharethroughBidAdapter_spec.js @@ -305,6 +305,19 @@ describe('sharethrough adapter spec', function () { const bidRequest = spec.buildRequests(bidRequests)[0]; expect(bidRequest.data).to.not.include.any.keys('schain'); }); + + it('should include the bidfloor parameter if it is present in the bid request', function() { + const bidRequest = Object.assign({}, bidRequests[0]); + bidRequest['bidfloor'] = 0.50; + const builtBidRequest = spec.buildRequests([bidRequest])[0]; + expect(builtBidRequest.data.bidfloor).to.eq(0.5); + }); + + it('should not include the bidfloor parameter if it is missing in the bid request', function() { + const bidRequest = Object.assign({}, bidRequests[0]); + const builtBidRequest = spec.buildRequests([bidRequest])[0]; + expect(builtBidRequest.data).to.not.include.any.keys('bidfloor'); + }); }); describe('.interpretResponse', function () {