diff --git a/modules/quantumBidAdapter.js b/modules/quantumBidAdapter.js index f6df8a2ff614..19f9fbe07e20 100644 --- a/modules/quantumBidAdapter.js +++ b/modules/quantumBidAdapter.js @@ -25,7 +25,7 @@ export const spec = { * @param {validBidRequests[]} - an array of bids * @return ServerRequest Info describing the request to the server. */ - buildRequests: function (bidRequests) { + buildRequests: function (bidRequests, bidderRequest) { return bidRequests.map(bid => { const qtxRequest = {}; let bidId = ''; @@ -55,6 +55,12 @@ export const spec = { bidId = bid.bidId; } qtxRequest.auid = placementId; + + if (bidderRequest && bidderRequest.gdprConsent) { + qtxRequest.quantx_user_consent_string = bidderRequest.gdprConsent.consentString; + qtxRequest.quantx_gdpr = bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0; + }; + const url = devEnpoint || ENDPOINT_URL; return { @@ -64,7 +70,8 @@ export const spec = { mediaType: mediaType, renderMode: renderMode, url: url, - 'data': qtxRequest + 'data': qtxRequest, + bidderRequest }; }); }, @@ -243,13 +250,21 @@ export const spec = { native.title = asset['title']['text']; break; case 2: - native.icon = asset['img']; + native.icon = { + url: asset['img'], + width: asset['w'], + height: asset['h'] + }; break; case 3: native.body = asset['data']['value']; break; case 4: - native.image = asset['img']; + native.image = { + url: asset['img'], + width: asset['w'], + height: asset['h'] + }; break; case 10: native.sponsoredBy = asset['data']['value']; diff --git a/test/spec/modules/quantumBidAdapter_spec.js b/test/spec/modules/quantumBidAdapter_spec.js index 053ec98ffaa1..f45b9ed37e72 100644 --- a/test/spec/modules/quantumBidAdapter_spec.js +++ b/test/spec/modules/quantumBidAdapter_spec.js @@ -234,6 +234,63 @@ describe('quantumBidAdapter', () => { }) }) + describe('GDPR conformity', () => { + const bidRequests = [{ + 'bidder': 'quantum', + 'mediaType': 'native', + 'params': { + placementId: 21546 + }, + adUnitCode: 'aaa', + transactionId: '2b8389fe-615c-482d-9f1a-376fb8f7d6b0', + sizes: [[0, 0]], + bidId: '1abgs362e0x48a8', + bidderRequestId: '70deaff71c281d', + auctionId: '5c66da22-426a-4bac-b153-77360bef5337' + }]; + + const bidderRequest = { + gdprConsent: { + consentString: 'awefasdfwefasdfasd', + gdprApplies: true + } + }; + + it('should transmit correct data', () => { + const requests = spec.buildRequests(bidRequests, bidderRequest); + expect(requests.length).to.equal(1); + expect(requests[0].data.quantx_gdpr).to.equal(1); + expect(requests[0].data.quantx_user_consent_string).to.equal('awefasdfwefasdfasd'); + }); + }); + + describe('GDPR absence conformity', () => { + const bidRequests = [{ + 'bidder': 'quantum', + 'mediaType': 'native', + 'params': { + placementId: 21546 + }, + adUnitCode: 'aaa', + transactionId: '2b8389fe-615c-482d-9f1a-376fb8f7d6b0', + sizes: [[0, 0]], + bidId: '1abgs362e0x48a8', + bidderRequestId: '70deaff71c281d', + auctionId: '5c66da22-426a-4bac-b153-77360bef5337' + }]; + + const bidderRequest = { + gdprConsent: undefined + }; + + it('should transmit correct data', () => { + const requests = spec.buildRequests(bidRequests, bidderRequest); + expect(requests.length).to.equal(1); + expect(requests[0].data.quantx_gdpr).to.be.undefined; + expect(requests[0].data.quantx_user_consent_string).to.be.undefined; + }); + }); + describe('interpretResponse', () => { let bidderRequest = { bidderCode: 'bidderCode',