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

Add gdpr support to ablida bid adapter #5741

Merged
merged 9 commits into from
Sep 16, 2020
5 changes: 3 additions & 2 deletions modules/ablidaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ export const spec = {
referer: bidderRequest.refererInfo.referer,
jaySupported: jaySupported,
device: device,
adapterVersion: 3,
mediaTypes: bidRequest.mediaTypes
adapterVersion: 4,
mediaTypes: bidRequest.mediaTypes,
gdprConsent: bidderRequest.gdprConsent
};
return {
method: 'POST',
Expand Down
70 changes: 47 additions & 23 deletions test/spec/modules/ablidaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ describe('ablidaBidAdapter', function () {
const adapter = newBidder(spec);
describe('isBidRequestValid', function () {
let bid = {
adUnitCode: 'adunit-code',
auctionId: '69e8fef8-5105-4a99-b011-d5669f3bc7f0',
bidRequestsCount: 1,
bidder: 'ablida',
bidderRequestId: '14d2939272a26a',
bidderRequestsCount: 1,
bidderWinsCount: 0,
bidId: '1234asdf1234',
mediaTypes: {banner: {sizes: [[300, 250]]}},
params: {
placementId: 123
},
adUnitCode: 'adunit-code',
sizes: [
[300, 250]
],
bidId: '1234asdf1234',
bidderRequestId: '1234asdf1234asdf',
auctionId: '69e8fef8-5105-4a99-b011-d5669f3bc7f0'
src: 'client',
transactionId: '4781e6ac-93c4-42ba-86fe-ab5f278863cf'
};
it('should return true where required params found', function () {
expect(spec.isBidRequestValid(bid)).to.equal(true);
Expand All @@ -28,22 +34,29 @@ describe('ablidaBidAdapter', function () {
describe('buildRequests', function () {
let bidRequests = [
{
adUnitCode: 'adunit-code',
auctionId: '69e8fef8-5105-4a99-b011-d5669f3bc7f0',
bidId: '23beaa6af6cdde',
bidRequestsCount: 1,
bidder: 'ablida',
bidderRequestId: '14d2939272a26a',
bidderRequestsCount: 1,
bidderWinsCount: 0,
mediaTypes: {banner: {sizes: [[300, 250]]}},
params: {
placementId: 123
},
sizes: [
[300, 250]
],
adUnitCode: 'adunit-code',
bidId: '23beaa6af6cdde',
bidderRequestId: '14d2939272a26a',
auctionId: '69e8fef8-5105-4a99-b011-d5669f3bc7f0',
src: 'client',
transactionId: '4781e6ac-93c4-42ba-86fe-ab5f278863cf'
}
];

let bidderRequests = {
refererInfo: {
canonicalUrl: '',
numIframes: 0,
reachedTop: true,
referer: 'http://example.com',
Expand All @@ -62,42 +75,53 @@ describe('ablidaBidAdapter', function () {
method: 'POST',
url: ENDPOINT_URL,
data: {
adapterVersion: 4,
bidId: '2b8c4de0116e54',
categories: undefined,
device: 'desktop',
gdprConsent: undefined,
jaySupported: true,
mediaTypes: {banner: {sizes: [[300, 250]]}},
placementId: 'testPlacementId',
width: 300,
height: 200,
bidId: '2b8c4de0116e54',
jaySupported: true,
device: 'desktop',
referer: 'www.example.com',
adapterVersion: 2
referer: 'www.example.com'
}
};
let serverResponse = {
body: [{
requestId: '2b8c4de0116e54',
ad: '<script>console.log("ad");</script>',
cpm: 1.00,
width: 300,
height: 250,
creativeId: '2b8c4de0116e54',
currency: 'EUR',
height: 250,
mediaType: 'banner',
meta: {},
netRevenue: true,
nurl: 'https://example.com/some-tracker',
originalCpm: '0.10',
originalCurrency: 'EUR',
requestId: '2b8c4de0116e54',
ttl: 3000,
ad: '<script>console.log("ad");</script>',
nurl: 'https://example.com/some-tracker'
width: 300
}]
};
it('should get the correct bid response', function () {
let expectedResponse = [{
requestId: '2b8c4de0116e54',
ad: '<script>console.log("ad");</script>',
cpm: 1.00,
width: 300,
height: 250,
creativeId: '2b8c4de0116e54',
currency: 'EUR',
height: 250,
mediaType: 'banner',
meta: {},
netRevenue: true,
nurl: 'https://example.com/some-tracker',
originalCpm: '0.10',
originalCurrency: 'EUR',
requestId: '2b8c4de0116e54',
ttl: 3000,
ad: '<script>console.log("ad");</script>',
nurl: 'https://example.com/some-tracker'
width: 300
}];
let result = spec.interpretResponse(serverResponse, bidRequest[0]);
expect(Object.keys(result)).to.deep.equal(Object.keys(expectedResponse));
Expand Down