Skip to content

Commit

Permalink
Ccpa legacy support for OneVideo (#4648)
Browse files Browse the repository at this point in the history
* outstream changes

* removing global filtet

* reverting page

* message

* adapter change

* remove space

* testcases

* testpage

* spaces for test page

* renderer exist case

* reverting package-lock.json

* adding schain object

* adding tagid

* syntaxx error fix

* video.html

* space trailing

* space

* tagid

* inventoryId and placement

* rewarded video

* added unit test case

* ccpa cahnges

* ccpa change

* test page

* test page change

* test page change 2

* change the variable

* handling the case if both GDPR and CCPA case

* handiling both cases

* test cases

* legacy ccpa support

* Update oneVideoBidAdapter.js
  • Loading branch information
DeepthiNeeladri authored and bretg committed Jan 2, 2020
1 parent 2585d64 commit 17d6073
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
20 changes: 9 additions & 11 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,13 @@ function getRequestData(bid, consentData, bidRequest) {
if (bid.params.site && bid.params.site.id) {
bidData.site.id = bid.params.site.id
}
if (isConsentRequired(consentData)) {
if (isConsentRequired(consentData) || (bidRequest && bidRequest.uspConsent)) {
bidData.regs = {
ext: {
gdpr: 1
}
ext: {}
};
if (isConsentRequired(consentData)) {
bidData.regs.ext.gdpr = 1
}

if (consentData.consentString) {
bidData.user = {
Expand All @@ -242,13 +243,10 @@ function getRequestData(bid, consentData, bidRequest) {
}
};
}
}
if (bidRequest && bidRequest.uspConsent) {
bidData.regs = {
ext: {
us_privacy: bidRequest.uspConsent
}
};
// CCPA support
if (bidRequest && bidRequest.uspConsent) {
bidData.regs.ext.us_privacy = bidRequest.uspConsent
}
}

return bidData;
Expand Down
23 changes: 18 additions & 5 deletions test/spec/modules/oneVideoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ describe('OneVideoBidAdapter', function () {
});
});

describe('when GDPR applies', function () {
describe('when GDPR and uspConsent applies', function () {
beforeEach(function () {
bidderRequest = {
'gdprConsent': {
'consentString': 'test-gdpr-consent-string',
'gdprApplies': true
},
'uspConsent\'s': '1YN-',
'uspConsent': '1YN-',
'bidderCode': 'oneVideo',
'auctionId': 'e158486f-8c7f-472f-94ce-b0cbfbb50ab4',
'bidderRequestId': '1e498b84fffc39',
Expand All @@ -221,9 +221,16 @@ describe('OneVideoBidAdapter', function () {

mockConfig = {
consentManagement: {
cmpApi: 'iab',
timeout: 1111,
allowAuctionWithoutConsent: 'cancel'
gdpr: {
cmpApi: 'iab',
timeout: 3000,
allowAuctionWithoutConsent: 'cancel'
},
usp: {
cmpApi: 'iab',
timeout: 1000,
allowAuctionWithoutConsent: 'cancel'
}
}
};
});
Expand All @@ -243,6 +250,12 @@ describe('OneVideoBidAdapter', function () {
expect(request[0].data.regs.ext.us_privacy).to.equal(bidderRequest.uspConsent);
});

it('should send the uspConsent and GDPR ', function () {
const request = spec.buildRequests([ bidRequest ], bidderRequest);
expect(request[0].data.regs.ext.gdpr).to.equal(1);
expect(request[0].data.regs.ext.us_privacy).to.equal(bidderRequest.uspConsent);
});

it('should send schain object', function () {
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
Expand Down

0 comments on commit 17d6073

Please sign in to comment.