Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boldwin Bid Adapter: added endpointId param #8798

Merged
merged 12 commits into from
Aug 10, 2022
15 changes: 12 additions & 3 deletions modules/boldwinBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions modules/boldwinBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
}
]
},
];
```
3 changes: 2 additions & 1 deletion test/spec/modules/boldwinBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down