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

NextMillennium Bid Adapter: fix an error when gdpr is undefined #7817

Merged
merged 1 commit into from
Dec 7, 2021
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
14 changes: 8 additions & 6 deletions modules/nextMillenniumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ export const spec = {
if (uspConsent) {
postBody.regs.ext.us_privacy = uspConsent;
}
if (typeof gdprConsent.gdprApplies !== 'undefined') {
postBody.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0;
}
if (typeof gdprConsent.consentString !== 'undefined') {
postBody.user = {
ext: { consent: gdprConsent.consentString }
if (gdprConsent) {
if (typeof gdprConsent.gdprApplies !== 'undefined') {
postBody.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0;
}
if (typeof gdprConsent.consentString !== 'undefined') {
postBody.user = {
ext: { consent: gdprConsent.consentString }
}
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions test/spec/modules/nextMillenniumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ describe('nextMillenniumBidAdapterTests', function() {
}
];

it('Request params check with GDPR Consent', function () {
it('Request params check with GDPR and USP Consent', function () {
const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
expect(JSON.parse(request[0].data).user.ext.consent).to.equal('kjfdniwjnifwenrif3');
expect(JSON.parse(request[0].data).regs.ext.us_privacy).to.equal('1---');
expect(JSON.parse(request[0].data).regs.ext.gdpr).to.equal(1);
});

it('Request params check without GDPR Consent', function () {
delete bidRequestData[0].gdprConsent
const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
expect(JSON.parse(request[0].data).regs.ext.gdpr).to.be.undefined;
expect(JSON.parse(request[0].data).regs.ext.us_privacy).to.equal('1---');
});

it('validate_generated_params', function() {
const request = spec.buildRequests(bidRequestData);
expect(request[0].bidId).to.equal('bid1234');
Expand All @@ -33,7 +40,7 @@ describe('nextMillenniumBidAdapterTests', function() {

it('Check if refresh_count param is incremented', function() {
const request = spec.buildRequests(bidRequestData);
expect(JSON.parse(request[0].data).refresh_count).to.equal(2);
expect(JSON.parse(request[0].data).refresh_count).to.equal(3);
});

it('Test getUserSyncs function', function () {
Expand Down