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

Quantumdex Bid Adapter: Change the data type of gdpr and schain object in Payload #5770

Merged
merged 1 commit into from
Sep 21, 2020
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
4 changes: 2 additions & 2 deletions modules/quantumdexBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ export const spec = {
// Apply GDPR parameters to request.
payload.gdpr = {};
if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr.gdprApplies = bidderRequest.gdprConsent.gdprApplies ? 'true' : 'false';
payload.gdpr.gdprApplies = !!bidderRequest.gdprConsent.gdprApplies;
if (bidderRequest.gdprConsent.consentString) {
payload.gdpr.consentString = bidderRequest.gdprConsent.consentString;
}
}
// Apply schain.
if (bids[0].schain) {
payload.schain = JSON.stringify(bids[0].schain)
payload.schain = bids[0].schain
}
// Apply us_privacy.
if (bidderRequest && bidderRequest.uspConsent) {
Expand Down
10 changes: 5 additions & 5 deletions test/spec/modules/quantumdexBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('QuantumdexBidAdapter', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('true')
expect(bidRequests.data.gdpr.gdprApplies).to.equal(true)
expect(bidRequests.data.gdpr.consentString).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
})

Expand All @@ -253,7 +253,7 @@ describe('QuantumdexBidAdapter', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('false')
expect(bidRequests.data.gdpr.gdprApplies).to.equal(false)
expect(bidRequests.data.gdpr.consentString).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
})
it('should return a properly formatted request with GDPR applies set to false with no consent_string param', function () {
Expand All @@ -273,7 +273,7 @@ describe('QuantumdexBidAdapter', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('false')
expect(bidRequests.data.gdpr.gdprApplies).to.equal(false)
expect(bidRequests.data.gdpr).to.not.include.keys('consentString')
})
it('should return a properly formatted request with GDPR applies set to true with no consentString param', function () {
Expand All @@ -293,12 +293,12 @@ describe('QuantumdexBidAdapter', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('true')
expect(bidRequests.data.gdpr.gdprApplies).to.equal(true)
expect(bidRequests.data.gdpr).to.not.include.keys('consentString')
})
it('should return a properly formatted request with schain defined', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(JSON.parse(bidRequests.data.schain)).to.deep.equal(bidRequest[0].schain)
expect(bidRequests.data.schain).to.deep.equal(bidRequest[0].schain)
});
it('should return a properly formatted request with us_privacy included', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
Expand Down