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

welect: update parameters to match backend specs of tcf2.0 #5613

Merged
merged 2 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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