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

feat(ccpa) : ccpa and pos added to legacy adapter #4817

Merged
merged 1 commit into from
Feb 4, 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
12 changes: 9 additions & 3 deletions modules/deepintentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ export const spec = {
imp: validBidRequests.map(bid => buildImpression(bid)),
site: buildSite(bidderRequest),
device: buildDevice(),
user: user && user.length == 1 ? user[0] : {}
user: user && user.length == 1 ? user[0] : {},
};

if (bidderRequest && bidderRequest.uspConsent) {
utils.deepSetValue(openRtbBidRequest, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}

return {
method: 'POST',
url: BIDDER_ENDPOINT,
Expand Down Expand Up @@ -127,13 +131,15 @@ function buildBanner(bid) {
if (utils.isArray(sizes) && sizes.length > 0) {
return {
h: sizes[0][1],
w: sizes[0][0]
w: sizes[0][0],
pos: bid && bid.params && bid.params.pos ? bid.params.pos : 0
}
}
} else {
return {
h: bid.params.height,
w: bid.params.width
w: bid.params.width,
pos: bid && bid.params && bid.params.pos ? bid.params.pos : 0
}
}
}
Expand Down
1 change: 1 addition & 0 deletions modules/deepintentBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Module that connects to Deepintent's demand sources.
tagId: '1300', // Required parameter
w: 300, // Width and Height here will override sizes in mediatype
h: 250,
pos: 1,
custom: { // Custom parameters in form of key value pairs
user_min_age: 18
}
Expand Down
20 changes: 19 additions & 1 deletion test/spec/modules/deepintentBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Deepintent adapter', function () {
tagId: '100013',
w: 728,
h: 90,
pos: 1,
user: {
id: 'di_testuid',
buyeruid: 'di_testbuyeruid',
Expand Down Expand Up @@ -129,6 +130,11 @@ describe('Deepintent adapter', function () {
expect(data.imp[0].ext).to.be.a('object');
expect(data.imp[0].ext.deepintent.position).to.equal('right-box');
});
it('bid request check: position check', function () {
let bRequest = spec.buildRequests(request);
let data = JSON.parse(bRequest.data);
expect(data.imp[0].banner.pos).to.equal(1);
});
it('bid request check: displaymanager check', function() {
let bRequest = spec.buildRequests(request);
let data = JSON.parse(bRequest.data);
Expand All @@ -143,7 +149,19 @@ describe('Deepintent adapter', function () {
expect(data.user.buyeruid).to.equal('di_testbuyeruid');
expect(data.user.yob).to.equal(2002);
expect(data.user.gender).to.equal('F');
})
});
it('bid request check: CCPA Check', function () {
let bidRequest = {
uspConsent: '1NYN'
};
let bRequest = spec.buildRequests(request, bidRequest);
let data = JSON.parse(bRequest.data);
expect(data.regs.ext.us_privacy).to.equal('1NYN');
let bidRequest2 = {};
let bRequest2 = spec.buildRequests(request, bidRequest2);
let data2 = JSON.parse(bRequest2.data);
expect(data2.regs).to.equal(undefined);
});
});
describe('user sync check', function () {
it('user sync url check', function () {
Expand Down