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

fix handling of gdpr object #3756

Merged
merged 29 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
afdf755
initial orbidder version in personal github repo
hendrikiseke1979 Jan 9, 2019
ffc6f0b
use adUnits from orbidder_example.html
hendrikiseke1979 Jan 9, 2019
5c9a947
replace obsolete functions
hendrikiseke1979 Jan 10, 2019
06d127e
forgot to commit the test
hendrikiseke1979 Jan 10, 2019
8617515
check if bidderRequest object is available
hendrikiseke1979 Jan 10, 2019
8b5c884
try to fix weird safari/ie issue
hendrikiseke1979 Jan 10, 2019
4eace10
Merge remote-tracking branch 'upstream/master'
hendrikiseke1979 Jan 14, 2019
8d9dd6f
merge changes from upstream
hendrikiseke1979 Jan 16, 2019
699d05d
fetch changes from upstream
hendrikiseke1979 Jan 17, 2019
367b1a7
ebayK: add more params
hendrikiseke1979 Jan 18, 2019
cfe0911
update orbidderBidAdapter.md
hendrikiseke1979 Jan 18, 2019
4279c11
use spec.<function> instead of this.<function> for consistency reasons
hendrikiseke1979 Jan 21, 2019
5625d93
fetch changes from upstream
hendrikiseke1979 Jan 21, 2019
67dc263
Merge branch 'feature/RAAS-2676'
hendrikiseke1979 Jan 21, 2019
89fb80b
fetch changes from upstream
hendrikiseke1979 Jan 24, 2019
ab665e9
fetch changes from upstream
hendrikiseke1979 Jan 28, 2019
b91d68d
fetch changes from upstream
Feb 1, 2019
393b3fe
fetch changes from upstream
Feb 15, 2019
d0b0cbc
fetch changes from upstream
hendrikiseke1979 Mar 5, 2019
5967f6e
fetch changes from upstream
hendrikiseke1979 Mar 6, 2019
df95b81
fetch changes from upstream
hendrikiseke1979 Mar 13, 2019
6169ec7
fetch changes from upstream
Mar 15, 2019
b05496f
add bidfloor parameter to params object
Mar 15, 2019
5a3d816
fetch changes from upstream
Mar 15, 2019
4c95866
fetch changes from upstream
hendrikiseke1979 Apr 2, 2019
e27e3dd
fetch changes from upstream
hendrikiseke1979 Apr 3, 2019
1470e8e
fetch changes from upstream
hendrikiseke1979 Apr 16, 2019
476c431
fix gdpr object handling
hendrikiseke1979 Apr 16, 2019
ff62c25
fetch changes from upstream
hendrikiseke1979 Apr 17, 2019
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
8 changes: 4 additions & 4 deletions modules/orbidderBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export const spec = {
}
};
spec.bidParams[bidRequest.bidId] = bidRequest.params;
if (bidRequest && bidRequest.gdprConsent) {
if (bidderRequest && bidderRequest.gdprConsent) {
ret.data.gdprConsent = {
consentString: bidRequest.gdprConsent.consentString,
consentRequired: (typeof bidRequest.gdprConsent.gdprApplies === 'boolean')
? bidRequest.gdprConsent.gdprApplies
consentString: bidderRequest.gdprConsent.consentString,
consentRequired: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean')
? bidderRequest.gdprConsent.gdprApplies
: true
};
}
Expand Down
57 changes: 29 additions & 28 deletions test/spec/modules/orbidderBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ describe('orbidderBidAdapter', () => {
return JSON.parse(JSON.stringify(val));
};

const buildRequest = function (buildRequest) {
return spec.buildRequests(
[buildRequest],
{
refererInfo: {
referer: 'http://localhost:9876/'
}
})[0];
const buildRequest = (buildRequest, bidderRequest) => {
if (!Array.isArray(buildRequest)) {
buildRequest = [buildRequest];
}

return spec.buildRequests(buildRequest, {
...bidderRequest || {},
refererInfo: {
referer: 'http://localhost:9876/'
}
})[0];
};

describe('inherited functions', () => {
Expand Down Expand Up @@ -101,44 +104,42 @@ describe('orbidderBidAdapter', () => {
});

it('handles empty gdpr object', () => {
const bidRequest = deepClone(defaultBidRequest);
bidRequest.gdprConsent = {};

const request = buildRequest(bidRequest);
const request = buildRequest(defaultBidRequest, {
gdprConsent: {}
});
expect(request.data.gdprConsent.consentRequired).to.be.equal(true);
});

it('handles non-existent gdpr object', () => {
const bidRequest = deepClone(defaultBidRequest);
bidRequest.gdprConsent = null;

const request = buildRequest(bidRequest);
const request = buildRequest(defaultBidRequest, {
gdprConsent: null
});
expect(request.data.gdprConsent).to.be.undefined;
});

it('handles properly filled gdpr object where gdpr applies', () => {
const consentString = 'someWeirdString';
const bidRequest = deepClone(defaultBidRequest);
bidRequest.gdprConsent = {
gdprApplies: true,
consentString: 'someWeirdString'
};
const request = buildRequest(defaultBidRequest, {
gdprConsent: {
gdprApplies: true,
consentString: consentString
}
});

const request = buildRequest(bidRequest);
const gdprConsent = request.data.gdprConsent;
expect(gdprConsent.consentRequired).to.be.equal(true);
expect(gdprConsent.consentString).to.be.equal(consentString);
});

it('handles properly filled gdpr object where gdpr does not apply', () => {
const consentString = 'someWeirdString';
const bidRequest = deepClone(defaultBidRequest);
bidRequest.gdprConsent = {
gdprApplies: false,
consentString: 'someWeirdString'
};
const request = buildRequest(defaultBidRequest, {
gdprConsent: {
gdprApplies: false,
consentString: consentString
}
});

const request = buildRequest(bidRequest);
const gdprConsent = request.data.gdprConsent;
expect(gdprConsent.consentRequired).to.be.equal(false);
expect(gdprConsent.consentString).to.be.equal(consentString);
Expand Down