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

prebidServerBidAdapter cleanup #2844

Merged
merged 5 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from 4 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
24 changes: 24 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,30 @@ export const spec = {
url: '//acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html'
}];
}
},

transformBidParams: function(params, isOpenRtb) {
params = utils.convertTypes({
'member': 'string',
'invCode': 'string',
'placementId': 'number',
'keywords': utils.transformBidderParamKeywords
}, params);

if (isOpenRtb) {
params.use_pmt_rule = (typeof params.usePaymentRule === 'boolean') ? params.usePaymentRule : false;
if (params.usePaymentRule) { delete params.usePaymentRule; }

Object.keys(params).forEach(paramKey => {
let convertedKey = utils.convertCamelToUnderscore(paramKey);
if (convertedKey !== paramKey) {
params[convertedKey] = params[paramKey];
delete params[paramKey];
}
});
}

return params;
}
}

Expand Down
17 changes: 15 additions & 2 deletions modules/audienceNetworkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { registerBidder } from 'src/adapters/bidderFactory';
import { config } from 'src/config';
import { formatQS } from 'src/url';
import { generateUUID, getTopWindowUrl, isSafariBrowser } from 'src/utils';
import { generateUUID, getTopWindowUrl, isSafariBrowser, convertTypes } from 'src/utils';
import findIndex from 'core-js/library/fn/array/find-index';
import includes from 'core-js/library/fn/array/includes';

Expand Down Expand Up @@ -242,12 +242,25 @@ const interpretResponse = ({ body }, { adformats, requestIds, sizes }) => {
});
};

/**
* Covert bid param types for S2S
* @param {Object} params bid params
* @param {Boolean} isOpenRtb boolean to check openrtb2 protocol
* @return {Object} params bid params
*/
const transformBidParams = (params, isOpenRtb) => {
return convertTypes({
'placementId': 'string'
}, params);
}

export const spec = {
code,
supportedMediaTypes,
isBidRequestValid,
buildRequests,
interpretResponse
interpretResponse,
transformBidParams
};

registerBidder(spec);
14 changes: 14 additions & 0 deletions modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,20 @@ export const spec = {
}

return bidResponses;
},

/**
* Covert bid param types for S2S
* @param {Object} params bid params
* @param {Boolean} isOpenRtb boolean to check openrtb2 protocol
* @return {Object} params bid params
*/
transformBidParams: function(params, isOpenRtb) {
return utils.convertTypes({
'site_id': 'string',
'secure': 'number',
'mobile': 'number'
}, params);
}
};

Expand Down
12 changes: 12 additions & 0 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ export const spec = {
}

return bids;
},

/**
* Covert bid param types for S2S
* @param {Object} params bid params
* @param {Boolean} isOpenRtb boolean to check openrtb2 protocol
* @return {Object} params bid params
*/
transformBidParams: function(params, isOpenRtb) {
return utils.convertTypes({
'siteID': 'number'
}, params);
}
};

Expand Down
6 changes: 6 additions & 0 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export const spec = {
url: url
}];
}
},
transformBidParams: function(params, isOpenRtb) {
return utils.convertTypes({
'unit': 'string',
'customFloor': 'number'
}, params);
}
};

Expand Down
64 changes: 64 additions & 0 deletions modules/prebidServerBidAdapter/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// import { transformBidderParamKeywords } from 'src/utils';

// accountId and bidders params are not included here, should be configured by end-user
export const S2S_VENDORS = {
'appnexus': {
adapter: 'prebidServer',
cookieSet: false,
enabled: true,
endpoint: '//prebid.adnxs.com/pbs/v1/openrtb2/auction',
syncEndpoint: '//prebid.adnxs.com/pbs/v1/cookie_sync',
timeout: 1000
},
'rubicon': {
adapter: 'prebidServer',
cookieSet: false,
enabled: true,
endpoint: '//prebid-server.rubiconproject.com/auction',
syncEndpoint: '//prebid-server.rubiconproject.com/cookie_sync',
timeout: 500
}
}

// export const paramTypes = {
// 'appnexus': {
// 'member': 'string',
// 'invCode': 'string',
// 'placementId': 'number',
// 'keywords': transformBidderParamKeywords
// },
// 'rubicon': {
// 'accountId': 'number',
// 'siteId': 'number',
// 'zoneId': 'number'
// },
// 'indexExchange': {
// 'siteID': 'number'
// },
// 'audienceNetwork': {
// 'placementId': 'string'
// },
// 'pubmatic': {
// 'publisherId': 'string',
// 'adSlot': 'string'
// },
// 'districtm': {
// 'member': 'string',
// 'invCode': 'string',
// 'placementId': 'number'
// },
// 'pulsepoint': {
// 'cf': 'string',
// 'cp': 'number',
// 'ct': 'number'
// },
// 'conversant': {
// 'site_id': 'string',
// 'secure': 'number',
// 'mobile': 'number'
// },
// 'openx': {
// 'unit': 'string',
// 'customFloor': 'number'
// },
// };
Loading