From 5769b50d07e613ee03a7e1f89c5c66255b6527c0 Mon Sep 17 00:00:00 2001 From: Victor R Date: Tue, 23 Jul 2024 14:06:05 -0700 Subject: [PATCH 1/3] New npi functionality for Lasso prebid adapter --- modules/lassoBidAdapter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lassoBidAdapter.js b/modules/lassoBidAdapter.js index 6215af03a97..5bd28c451c5 100644 --- a/modules/lassoBidAdapter.js +++ b/modules/lassoBidAdapter.js @@ -44,6 +44,8 @@ export const spec = { sizes, aimXR, uid: '$UID', + npi: bidRequest.params.npi || '', + npi_hash: bidRequest.params.npiHash || '', params: JSON.stringify(bidRequest.params), crumbs: JSON.stringify(bidRequest.crumbs), prebidVersion: '$prebid.version$', @@ -128,7 +130,7 @@ function getBidRequestUrl(aimXR, params) { if (params && params.dtc) { path = '/dtc-request'; } - if (!aimXR) { + if (!aimXR && !(params.npi || params.npiHash)) { return GET_IUD_URL + ENDPOINT_URL + path; } return ENDPOINT_URL + path; From d7e5b2ac42a454f6f696ee0cd19a7cbd05cfcfbb Mon Sep 17 00:00:00 2001 From: Victor R Date: Tue, 23 Jul 2024 14:14:10 -0700 Subject: [PATCH 2/3] New npi functionality for Lasso prebid adapter --- modules/lassoBidAdapter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/lassoBidAdapter.js b/modules/lassoBidAdapter.js index 5bd28c451c5..dc36cb4af23 100644 --- a/modules/lassoBidAdapter.js +++ b/modules/lassoBidAdapter.js @@ -130,10 +130,10 @@ function getBidRequestUrl(aimXR, params) { if (params && params.dtc) { path = '/dtc-request'; } - if (!aimXR && !(params.npi || params.npiHash)) { - return GET_IUD_URL + ENDPOINT_URL + path; + if (aimXR || params.npi || params.npiHash) { + return ENDPOINT_URL + path; } - return ENDPOINT_URL + path; + return GET_IUD_URL + ENDPOINT_URL + path; } function getDeviceData() { From 1333aa7c4a0b708cece486e2f439878e396e4fee Mon Sep 17 00:00:00 2001 From: Victor R Date: Tue, 10 Dec 2024 21:06:06 -0800 Subject: [PATCH 3/3] Update unit tests for lasso prebid adapter --- test/spec/modules/lassoBidAdapter_spec.js | 72 ++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/test/spec/modules/lassoBidAdapter_spec.js b/test/spec/modules/lassoBidAdapter_spec.js index 15dee20e566..f33869e9366 100644 --- a/test/spec/modules/lassoBidAdapter_spec.js +++ b/test/spec/modules/lassoBidAdapter_spec.js @@ -3,6 +3,7 @@ import { spec } from 'modules/lassoBidAdapter.js'; import { server } from '../../mocks/xhr'; const ENDPOINT_URL = 'https://trc.lhmos.com/prebid'; +const GET_IUD_URL = 'https://secure.adnxs.com/getuid?'; const bid = { bidder: 'lasso', @@ -78,7 +79,7 @@ describe('lassoBidAdapter', function () { }); }); - describe('buildRequests', function () { + describe('buildRequests with standard flow', function () { let validBidRequests, bidRequest; before(() => { validBidRequests = spec.buildRequests([bid], bidderRequest); @@ -97,6 +98,75 @@ describe('lassoBidAdapter', function () { expect(bidRequest.method).to.exist; expect(bidRequest.method).to.equal('GET'); }); + + it('should send request to get uid and trc via get request', () => { + expect(bidRequest.method).to.equal('GET'); + expect(bidRequest.url).to.equal(GET_IUD_URL + ENDPOINT_URL + '/request'); + }); + }); + + describe('buildRequests with npi', function () { + let validBidRequests, bidRequest; + before(() => { + const updateBidParams = Object.assign({}, bid, { + params: { + adUnitId: 123456, + npi: '123' + } + }); + validBidRequests = spec.buildRequests([updateBidParams], bidderRequest); + expect(validBidRequests).to.be.an('array').that.is.not.empty; + bidRequest = validBidRequests[0]; + }) + + it('Returns valid bidRequest', function () { + expect(bidRequest).to.exist; + expect(bidRequest.method).to.exist; + expect(bidRequest.url).to.exist; + expect(bidRequest.data).to.exist; + }); + + it('Returns GET method', function() { + expect(bidRequest.method).to.exist; + expect(bidRequest.method).to.equal('GET'); + }); + + it('should send request to trc via get request with npi', () => { + expect(bidRequest.method).to.equal('GET'); + expect(bidRequest.url).to.equal(ENDPOINT_URL + '/request'); + }); + }); + + describe('buildRequests with npi hash', function () { + let validBidRequests, bidRequest; + before(() => { + const updateBidParams = Object.assign({}, bid, { + params: { + adUnitId: 123456, + npiHash: '123' + } + }); + validBidRequests = spec.buildRequests([updateBidParams], bidderRequest); + expect(validBidRequests).to.be.an('array').that.is.not.empty; + bidRequest = validBidRequests[0]; + }) + + it('Returns valid bidRequest', function () { + expect(bidRequest).to.exist; + expect(bidRequest.method).to.exist; + expect(bidRequest.url).to.exist; + expect(bidRequest.data).to.exist; + }); + + it('Returns GET method', function() { + expect(bidRequest.method).to.exist; + expect(bidRequest.method).to.equal('GET'); + }); + + it('should send request to trc via get request with npi', () => { + expect(bidRequest.method).to.equal('GET'); + expect(bidRequest.url).to.equal(ENDPOINT_URL + '/request'); + }); }); describe('interpretResponse', function () {