Skip to content

Commit

Permalink
DeepIntent: Gdpr support (#5147)
Browse files Browse the repository at this point in the history
* feat(gdpr) : gdpr support added

* tests fixed
  • Loading branch information
sourabhg authored May 6, 2020
1 parent bb6cb10 commit fd26f66
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/deepintentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export const spec = {
utils.deepSetValue(openRtbBidRequest, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}

if (bidderRequest && bidderRequest.gdprConsent) {
utils.deepSetValue(openRtbBidRequest, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
utils.deepSetValue(openRtbBidRequest, 'regs.ext.gdpr', (bidderRequest.gdprConsent.gdprApplies ? 1 : 0));
}

return {
method: 'POST',
url: BIDDER_ENDPOINT,
Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/deepintentBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ describe('Deepintent adapter', function () {
let data2 = JSON.parse(bRequest2.data);
expect(data2.regs).to.equal(undefined);
});
it('bid Request check: GDPR Check', function () {
let bidRequest = {
gdprConsent: {
consentString: 'kjfdnidasd123sadsd',
gdprApplies: true
}
};
let bRequest = spec.buildRequests(request, bidRequest);
let data = JSON.parse(bRequest.data);
expect(data.user.ext.consent).to.equal('kjfdnidasd123sadsd');
expect(data.regs.ext.gdpr).to.equal(1);
let bidRequest2 = {};
let bRequest2 = spec.buildRequests(request, bidRequest2);
let data2 = JSON.parse(bRequest2.data);
expect(data2.regs).to.equal(undefined);
expect(data2.user.ext).to.equal(undefined);
});
});
describe('user sync check', function () {
it('user sync url check', function () {
Expand Down

0 comments on commit fd26f66

Please sign in to comment.