Skip to content

Commit

Permalink
welect: update parameters to match backend specs of tcf2.0 (prebid#5613)
Browse files Browse the repository at this point in the history
* update parameters to match backend specs of tcf2.0

* add gvlid to spec
  • Loading branch information
nduitz authored Sep 22, 2020
1 parent b211409 commit 9297612
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
37 changes: 21 additions & 16 deletions modules/welectBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const DEFAULT_DOMAIN = 'www.welect.de';
export const spec = {
code: BIDDER_CODE,
aliases: ['wlt'],
gvlid: 282,
supportedMediaTypes: ['video'],

// short code
Expand All @@ -17,7 +18,10 @@ export const spec = {
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: function (bid) {
return utils.deepAccess(bid, 'mediaTypes.video.context') === 'instream' && !!(bid.params.placementId);
return (
utils.deepAccess(bid, 'mediaTypes.video.context') === 'instream' &&
!!bid.params.placementId
);
},
/**
* Make a server request from the list of BidRequests.
Expand All @@ -26,9 +30,11 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (validBidRequests) {
return validBidRequests.map(bidRequest => {
let rawSizes = utils.deepAccess(bidRequest, 'mediaTypes.video.playerSize') || bidRequest.sizes;
let size = rawSizes[0]
return validBidRequests.map((bidRequest) => {
let rawSizes =
utils.deepAccess(bidRequest, 'mediaTypes.video.playerSize') ||
bidRequest.sizes;
let size = rawSizes[0];

let domain = bidRequest.params.domain || DEFAULT_DOMAIN;

Expand All @@ -38,20 +44,19 @@ export const spec = {

if (bidRequest && bidRequest.gdprConsent) {
gdprConsent = {
gdpr_consent:
{
gdpr_applies: bidRequest.gdprConsent.gdprApplies,
gdpr_consent: bidRequest.gdprConsent.gdprConsent
}
}
gdpr_consent: {
gdprApplies: bidRequest.gdprConsent.gdprApplies,
tcString: bidRequest.gdprConsent.gdprConsent,
},
};
}

const data = {
width: size[0],
height: size[1],
bid_id: bidRequest.bidId,
...gdprConsent
}
...gdprConsent,
};

return {
method: 'POST',
Expand All @@ -61,8 +66,8 @@ export const spec = {
contentType: 'application/json',
withCredentials: false,
crossOrigin: true,
}
}
},
};
});
},
/**
Expand All @@ -82,6 +87,6 @@ export const spec = {
const bidResponse = responseBody.bidResponse;
bidResponses.push(bidResponse);
return bidResponses;
}
}
},
};
registerBidder(spec);
8 changes: 4 additions & 4 deletions test/spec/modules/welectBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ describe('WelectAdapter', function () {
width: 640,
height: 360,
gdpr_consent: {
gdpr_applies: 1,
gdpr_consent: 'some_string'
gdprApplies: 1,
tcString: 'some_string'
}
}

Expand Down Expand Up @@ -166,8 +166,8 @@ describe('WelectAdapter', function () {
width: 640,
height: 320,
gdpr_consent: {
gdpr_applies: 1,
gdpr_consent: 'some_string'
gdprApplies: 1,
tcString: 'some_string'
}
},
method: 'POST',
Expand Down

0 comments on commit 9297612

Please sign in to comment.