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

Proxistore: gdpr compliant #4567

Closed
wants to merge 5 commits into from
Closed
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
8 changes: 6 additions & 2 deletions modules/proxistoreBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { registerBidder } = require('../src/adapters/bidderFactory');
const BIDDER_CODE = 'proxistore';

const PROXISTORE_VENDOR_ID = 418;
function _getFormatSize(sizeArr) {
return {
width: sizeArr[0],
Expand Down Expand Up @@ -31,7 +31,11 @@ function _createServerRequest(bidRequest, bidderRequest) {
payload.gdpr.applies = true;
}
if ((typeof bidderRequest.gdprConsent.consentString === 'string') && bidderRequest.gdprConsent.consentString) {
payload.gdpr['consentString'] = bidderRequest.gdprConsent.consentString;
payload.gdpr.consentString = bidderRequest.gdprConsent.consentString;
}
if (bidderRequest.gdprConsent.vendorData && bidderRequest.gdprConsent.vendorData.vendorConsents &&
typeof bidderRequest.gdprConsent.vendorData.vendorConsents[ PROXISTORE_VENDOR_ID.toString(10) ] !== 'undefined') {
payload.gdpr.consentGiven = !!(bidderRequest.gdprConsent.vendorData.vendorConsents[ PROXISTORE_VENDOR_ID.toString(10) ]);
}
}

Expand Down
20 changes: 17 additions & 3 deletions test/spec/modules/proxistoreBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
let spec = require('modules/proxistoreBidAdapter');

const BIDDER_CODE = 'proxistore';

describe('ProxistoreBidAdapter', function () {
const bidderRequest = {
'bidderCode': BIDDER_CODE,
Expand All @@ -10,8 +10,14 @@ describe('ProxistoreBidAdapter', function () {
'gdprConsent': {
'gdprApplies': true,
'consentString': 'CONSENT_STRING',
'vendorData': {
'vendorConsents': {
'418': true
}
}
}
};

let bid = {
sizes: [[300, 600]],
params: {
Expand All @@ -22,12 +28,13 @@ describe('ProxistoreBidAdapter', function () {
bidId: 464646969,
transactionId: 511916005
};

describe('isBidRequestValid', function () {
it('it should be true if required params are presents', function () {
expect(spec.isBidRequestValid(bid)).to.equal(true);
});
});

describe('buildRequests', function () {
const url = '//abs.proxistore.com/fr/v3/rtb/prebid';
const request = spec.buildRequests([bid], bidderRequest);
Expand All @@ -40,7 +47,12 @@ describe('ProxistoreBidAdapter', function () {
});
it('should contain a valid url', function () {
expect(request[0].url).equal(url);
})
});
it('should give consent if proxistore is in the vendor list', function () {
const data = JSON.parse(request[0].data);
expect(data.gdpr['consentString']).equal(bidderRequest.gdprConsent.consentString);
expect(data.gdpr.consentGiven).equal(true);
});
});

describe('interpretResponse', function () {
Expand All @@ -62,10 +74,12 @@ describe('ProxistoreBidAdapter', function () {
};
const badResponse = { body: [] };
const interpretedResponse = spec.interpretResponse(responses, bid)[0];

it('should send an empty array if body is empty', function () {
expect(spec.interpretResponse(badResponse, bid)).to.be.an('array');
expect(spec.interpretResponse(badResponse, bid).length).equal(0);
});

it('should interprnet the response correctly if it is valid', function () {
expect(interpretedResponse.cpm).equal(6.25);
expect(interpretedResponse.creativeId).equal('48fd47c9-ce35-4fda-804b-17e16c8c36ac');
Expand Down