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

Boldwin Adapter: gpp support #10370

Merged
merged 17 commits into from
Sep 6, 2023
9 changes: 9 additions & 0 deletions modules/boldwinBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ export const spec = {
if (bidderRequest.gdprConsent) {
request.gdpr = bidderRequest.gdprConsent;
}

// Add GPP consent
if (bidderRequest.gppConsent) {
request.gpp = bidderRequest.gppConsent.gppString;
request.gpp_sid = bidderRequest.gppConsent.applicableSections;
} else if (bidderRequest.ortb2?.regs?.gpp) {
request.gpp = bidderRequest.ortb2.regs.gpp;
request.gpp_sid = bidderRequest.ortb2.regs.gpp_sid;
}
}
const len = validBidRequests.length;

Expand Down
33 changes: 32 additions & 1 deletion test/spec/modules/boldwinBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ describe('BoldwinBidAdapter', function () {
const bidderRequest = {
refererInfo: {
referer: 'test.com'
}
},
ortb2: {}
};

describe('isBidRequestValid', function () {
Expand Down Expand Up @@ -110,6 +111,36 @@ describe('BoldwinBidAdapter', function () {
expect(data.placements).to.be.an('array').that.is.empty;
});
});

describe('gpp consent', function () {
it('bidderRequest.gppConsent', () => {
bidderRequest.gppConsent = {
gppString: 'abc123',
applicableSections: [8]
};

let serverRequest = spec.buildRequests([bid], bidderRequest);
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.property('gpp');
expect(data).to.have.property('gpp_sid');

delete bidderRequest.gppConsent;
})

it('bidderRequest.ortb2.regs.gpp', () => {
bidderRequest.ortb2.regs = bidderRequest.ortb2.regs || {};
bidderRequest.ortb2.regs.gpp = 'abc123';
bidderRequest.ortb2.regs.gpp_sid = [8];

let serverRequest = spec.buildRequests([bid], bidderRequest);
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.property('gpp');
expect(data).to.have.property('gpp_sid');
})
});

describe('interpretResponse', function () {
it('Should interpret banner response', function () {
const banner = {
Expand Down