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

TL-17557: Incorrectly passing FPD KVs #12

Merged
8 commits merged into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 18 additions & 3 deletions modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ function _buildPostBody(bidRequests) {
let imp = {
id: index,
tagid: bidRequest.params.inventoryCode,
floor: _getFloor(bidRequest)
floor: _getFloor(bidRequest),
fpd: _getAdUnitFpd(bidRequest)
};
// remove the else to support multi-imp
if (_isInstreamBidRequest(bidRequest)) {
Expand Down Expand Up @@ -184,12 +185,26 @@ function _getFloor (bid) {

function _getGlobalFpd() {
let fpd = {};
let context = {}
kzhouTL marked this conversation as resolved.
Show resolved Hide resolved
let user = {};

const fpdContext = Object.assign({}, config.getConfig('fpd.context'));
const fpdUser = Object.assign({}, config.getConfig('fpd.user'));

_addEntries(fpd, fpdContext);
_addEntries(fpd, fpdUser);
_addEntries(context, fpdContext);
_addEntries(user, fpdUser);
kzhouTL marked this conversation as resolved.
Show resolved Hide resolved

if (!utils.isEmpty(context)) {
fpd.context = context;
}
if (!utils.isEmpty(user)) {
fpd.user = user;
}
return fpd;
}

function _getAdUnitFpd(bid) {
let fpd = {};
return fpd;
This conversation was marked as resolved.
Show resolved Hide resolved
}

Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,9 @@ describe('triplelift adapter', function () {
});
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const { data: payload } = request;
expect(payload.ext.fpd).to.not.haveOwnProperty('sens');
expect(payload.ext.fpd).to.haveOwnProperty('category');
expect(payload.ext.fpd).to.haveOwnProperty('pmp_elig');
expect(payload.ext.fpd.user).to.not.exist;
expect(payload.ext.fpd.context).to.haveOwnProperty('category');
expect(payload.ext.fpd.context).to.haveOwnProperty('pmp_elig');
});
});

Expand Down