Skip to content

Commit

Permalink
Sonobi - Fixed issue where consent_string param could be set as undef…
Browse files Browse the repository at this point in the history
…ined (#2656)

* added vp param to trinity request

* added lib_name and lib_v to trinity

* return null from buildRequests if there is no keymakers

* added test case for empty keymaker

* only importing functions we need from utils

* changed window.pbjs.version to use the gulp repalced macro .version$

* fixed issue where isEmpty was being called from old utils var. Changed test port expectations to the original 9876 port

* fixed lint issue

* fixed issue where sonobi getUserSync was throwing an error on timeout

* sonobi support referrer param

* fixed unit test for testing the ref param on bid request

* return null from buildRequests if there is no keymakers

* fixed issue where isEmpty was being called from old utils var. Changed test port expectations to the original 9876 port

* Add gdpr support

* only sending consent string if it exists
  • Loading branch information
JonGoSonobi authored and jaiminpanchal27 committed Jun 1, 2018
1 parent 6f0a2db commit 2fb4878
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const spec = {
// Apply GDPR parameters to request.
if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr = bidderRequest.gdprConsent.gdprApplies ? 'true' : 'false';
payload.consent_string = bidderRequest.gdprConsent.consentString;
if (bidderRequest.gdprConsent.consentString) {
payload.consent_string = bidderRequest.gdprConsent.consentString;
}
}

// If there is no key_maker data, then don't make the request.
Expand Down
29 changes: 28 additions & 1 deletion test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,34 @@ describe('SonobiBidAdapter', () => {
expect(bidRequests.data.gdpr).to.equal('false')
expect(bidRequests.data.consent_string).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
})

it('should return a properly formatted request with GDPR applies set to false with no consent_string param', () => {
let bidderRequests = {
'gdprConsent': {
'consentString': undefined,
'vendorData': {},
'gdprApplies': false
},
};
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json')
expect(bidRequests.method).to.equal('GET')
expect(bidRequests.data.gdpr).to.equal('false')
expect(bidRequests.data).to.not.include.keys('consent_string')
})
it('should return a properly formatted request with GDPR applies set to true with no consent_string param', () => {
let bidderRequests = {
'gdprConsent': {
'consentString': undefined,
'vendorData': {},
'gdprApplies': true
},
};
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json')
expect(bidRequests.method).to.equal('GET')
expect(bidRequests.data.gdpr).to.equal('true')
expect(bidRequests.data).to.not.include.keys('consent_string')
})
it('should return a properly formatted request with hfa', () => {
bidRequest[0].params.hfa = 'hfakey'
bidRequest[1].params.hfa = 'hfakey'
Expand Down

0 comments on commit 2fb4878

Please sign in to comment.