From af3e7faf523b878551d1f5f39f5c47b4ea4ca157 Mon Sep 17 00:00:00 2001 From: Parth Shah Date: Thu, 28 Mar 2024 01:11:09 +0530 Subject: [PATCH] DeepIntent Bid Adapter : add gpp and coppa compliance support (#11239) * add gpp and coppa compliance checks and tests * update test case * resolve comments * read coppa as per updated docs * update test suite * update test suite --- modules/deepintentBidAdapter.js | 14 +++++++++ .../spec/modules/deepintentBidAdapter_spec.js | 31 ++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/modules/deepintentBidAdapter.js b/modules/deepintentBidAdapter.js index 7c24cd6a8f6..0a64ed88ca5 100644 --- a/modules/deepintentBidAdapter.js +++ b/modules/deepintentBidAdapter.js @@ -98,6 +98,20 @@ export const spec = { deepSetValue(openRtbBidRequest, 'regs.ext.gdpr', (bidderRequest.gdprConsent.gdprApplies ? 1 : 0)); } + // GPP Consent + if (bidderRequest?.gppConsent?.gppString) { + deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.gppConsent.gppString); + deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.gppConsent.applicableSections); + } else if (bidderRequest?.ortb2?.regs?.gpp) { + deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.ortb2.regs.gpp); + deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.ortb2.regs.gpp_sid); + } + + // coppa compliance + if (bidderRequest?.ortb2?.regs?.coppa) { + deepSetValue(openRtbBidRequest, 'regs.coppa', 1); + } + injectEids(openRtbBidRequest, validBidRequests); return { diff --git a/test/spec/modules/deepintentBidAdapter_spec.js b/test/spec/modules/deepintentBidAdapter_spec.js index d2a351b4089..644e9255789 100644 --- a/test/spec/modules/deepintentBidAdapter_spec.js +++ b/test/spec/modules/deepintentBidAdapter_spec.js @@ -357,5 +357,34 @@ describe('Deepintent adapter', function () { let response = spec.interpretResponse(invalidResponse, bRequest); expect(response[0].mediaType).to.equal(undefined); }); - }) + }); + describe('GPP and coppa', function() { + it('Request params check with GPP Consent', function () { + let bidderReq = {gppConsent: {gppString: 'gpp-string-test', applicableSections: [5]}}; + let bRequest = spec.buildRequests(request, bidderReq); + let data = JSON.parse(bRequest.data); + expect(data.regs.gpp).to.equal('gpp-string-test'); + expect(data.regs.gpp_sid[0]).to.equal(5); + }); + it('Request params check with GPP Consent read from ortb2', function () { + let bidderReq = { + ortb2: { + regs: { + gpp: 'gpp-test-string', + gpp_sid: [5] + } + } + }; + let bRequest = spec.buildRequests(request, bidderReq); + let data = JSON.parse(bRequest.data); + expect(data.regs.gpp).to.equal('gpp-test-string'); + expect(data.regs.gpp_sid[0]).to.equal(5); + }); + it('should include coppa flag in bid request if coppa is set to true', () => { + let bidderReq = {ortb2: {regs: {coppa: 1}}}; + let bRequest = spec.buildRequests(request, bidderReq); + let data = JSON.parse(bRequest.data); + expect(data.regs.coppa).to.equal(1); + }); + }); });