From d5247e68ea5018a1920906e94202d8c59bd3adf2 Mon Sep 17 00:00:00 2001 From: Wls-demo <67785512+Wls-demo@users.noreply.github.com> Date: Wed, 10 Aug 2022 19:00:12 +0300 Subject: [PATCH] Boldwin Bid Adapter: added endpointId param (#8798) * new boldwin bid adapter * fix * Restarting ci / circleci * changes * fixed conflicts * added endpointId param * kick off CircleCI tests Co-authored-by: Aiholkin Co-authored-by: Vladislav Isaiko Co-authored-by: Mykhailo Yaremchuk Co-authored-by: Chris Huie --- modules/boldwinBidAdapter.js | 15 ++++++++++++--- modules/boldwinBidAdapter.md | 17 +++++++++++++++++ test/spec/modules/boldwinBidAdapter_spec.js | 3 ++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/modules/boldwinBidAdapter.js b/modules/boldwinBidAdapter.js index ec580f8c3c2..ec9aeb2b888 100644 --- a/modules/boldwinBidAdapter.js +++ b/modules/boldwinBidAdapter.js @@ -46,7 +46,7 @@ export const spec = { supportedMediaTypes: [BANNER, VIDEO, NATIVE], isBidRequestValid: (bid) => { - return Boolean(bid.bidId && bid.params && bid.params.placementId); + return Boolean(bid.bidId && bid.params && (bid.params.placementId || bid.params.endpointId)); }, buildRequests: (validBidRequests = [], bidderRequest) => { @@ -85,7 +85,7 @@ export const spec = { for (let i = 0; i < len; i++) { let bid = validBidRequests[i]; - const { mediaTypes } = bid; + const { mediaTypes, params } = bid; const placement = {}; let sizes; if (mediaTypes) { @@ -114,9 +114,18 @@ export const spec = { placement.native = mediaTypes[NATIVE]; } } + + const { placementId, endpointId } = params; + if (placementId) { + placement.placementId = placementId; + placement.type = 'publisher'; + } else if (endpointId) { + placement.endpointId = endpointId; + placement.type = 'network'; + } + placements.push({ ...placement, - placementId: bid.params.placementId, bidId: bid.bidId, sizes: sizes || [], wPlayer: sizes ? sizes[0] : 0, diff --git a/modules/boldwinBidAdapter.md b/modules/boldwinBidAdapter.md index 5e2a5b139b3..47f4b4ffe78 100644 --- a/modules/boldwinBidAdapter.md +++ b/modules/boldwinBidAdapter.md @@ -47,5 +47,22 @@ Module that connects to boldwin demand sources } ] } + // Will return static test banner + { + code: 'endpointId_0', + mediaTypes: { + banner: { + sizes: [[300, 250]], + } + }, + bids: [ + { + bidder: 'boldwin', + params: { + endpointId: 'testBanner', + } + } + ] + }, ]; ``` diff --git a/test/spec/modules/boldwinBidAdapter_spec.js b/test/spec/modules/boldwinBidAdapter_spec.js index afb5f935621..5b51183ea6d 100644 --- a/test/spec/modules/boldwinBidAdapter_spec.js +++ b/test/spec/modules/boldwinBidAdapter_spec.js @@ -59,11 +59,12 @@ describe('BoldwinBidAdapter', function () { expect(data.gdpr).to.not.exist; expect(data.ccpa).to.not.exist; let placement = data['placements'][0]; - expect(placement).to.have.keys('placementId', 'bidId', 'adFormat', 'sizes', 'hPlayer', 'wPlayer', 'schain', 'bidFloor'); + expect(placement).to.have.keys('placementId', 'bidId', 'adFormat', 'sizes', 'hPlayer', 'wPlayer', 'schain', 'bidFloor', 'type'); expect(placement.placementId).to.equal('testBanner'); expect(placement.bidId).to.equal('23fhj33i987f'); expect(placement.adFormat).to.equal(BANNER); expect(placement.schain).to.be.an('object'); + expect(placement.type).to.exist.and.to.equal('publisher'); }); it('Returns valid data for mediatype video', function () {