From 4676090400732f0e3bbe3c5273520d5c8e253e92 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Thu, 18 Mar 2021 16:24:22 +0530 Subject: [PATCH 01/11] doceree adapter --- modules/docereeBidAdapter.js | 96 +++++++++++++++++++++ modules/docereeBidAdapter.md | 47 +++++----- test/spec/modules/docereeBidAdapter_spec.js | 93 ++++++++++++++++++++ 3 files changed, 213 insertions(+), 23 deletions(-) create mode 100644 modules/docereeBidAdapter.js create mode 100644 test/spec/modules/docereeBidAdapter_spec.js diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js new file mode 100644 index 00000000000..598231067a9 --- /dev/null +++ b/modules/docereeBidAdapter.js @@ -0,0 +1,96 @@ +import * as utils from '../src/utils.js'; +import { ajax } from '../src/ajax.js'; +import { registerBidder } from '../src/adapters/bidderFactory.js'; +import { config } from '../src/config.js'; +import { BANNER } from '../src/mediaTypes.js'; +const BIDDER_CODE = 'doceree'; +const END_POINT = 'https://bidder.doceree.com' + +function processHTMLAndRender(responseJson, creativeHtml) { + if (responseJson.sourceURL) { + creativeHtml = creativeHtml.replace('', ``); + } + creativeHtml = creativeHtml.replaceAll('[TRACKING_LINK]', responseJson.ctaLink); + creativeHtml = creativeHtml.replaceAll(/DOCEREE_CLICK_URL_UNESC/g, responseJson.ctaLink); + while (creativeHtml.indexOf('_ucid') > -1) { + creativeHtml = creativeHtml.replace('_ucid', utils.generateUUID()) + } + return creativeHtml; +} + +export const spec = { + code: BIDDER_CODE, + url: '', + supportedMediaTypes: [ BANNER ], + + isBidRequestValid: (bid) => { + const { placementId } = bid.params; + return !!placementId + }, + buildRequests: (validBidRequests) => { + const serverRequests = []; + const { data } = config.getConfig('doceree.user') + const { page, domain, token } = config.getConfig('doceree.context') + const encodedUserInfo = window.btoa(encodeURIComponent(JSON.stringify(data))) + + validBidRequests.forEach(function(validBidRequest) { + const { publisherUrl, placementId } = validBidRequest.params; + const url = publisherUrl || page + let queryString = ''; + queryString = utils.tryAppendQueryString(queryString, 'id', placementId); + queryString = utils.tryAppendQueryString(queryString, 'publisherDomain', domain); + queryString = utils.tryAppendQueryString(queryString, 'pubRequestedURL', encodeURIComponent(url)); + queryString = utils.tryAppendQueryString(queryString, 'loggedInUser', encodedUserInfo); + queryString = utils.tryAppendQueryString(queryString, 'currentUrl', url); + queryString = utils.tryAppendQueryString(queryString, 'prebidjs', true); + queryString = utils.tryAppendQueryString(queryString, 'token', token); + queryString = utils.tryAppendQueryString(queryString, 'requestId', validBidRequest.bidId); + + serverRequests.push({ + method: 'GET', + url: END_POINT + '/v1/adrequest?' + queryString + }) + }) + return serverRequests; + }, + interpretResponse: (serverResponse, request) => { + const responseJson = serverResponse ? serverResponse.body : {}; + const placementId = responseJson.DIVID; + const bidResponse = { + width: Number(responseJson.width), + height: Number(responseJson.height), + requestId: responseJson.guid, + netRevenue: true, + ttl: 30, + cpm: responseJson.cpmBid, + currency: responseJson.currency, + mediaType: 'banner', + creativeId: placementId, + }; + + if (responseJson.creativeType && responseJson.creativeType !== 'banner') { + if (responseJson.sourceHTML) { + responseJson.sourceHTML = responseJson.sourceHTML.replace(/[\uE000-\uF8FF]/g, ''); + let creative = processHTMLAndRender(responseJson, responseJson.sourceHTML) + bidResponse.ad = `
${creative}
` + } else { + ajax(responseJson.sourceURL, function(error, creativeHtml) { + if (!error) { + let creative = processHTMLAndRender(responseJson, creativeHtml) + bidResponse.ad = `
${creative}
` + } + }, null, {method: 'GET', customHeaders: {'Content-type': 'plain/html; charset=utf-8'}}); + } + } else { + if (responseJson.ctaLink) { + bidResponse.ad = ``; + } else { + bidResponse.ad = `
`; + } + } + var bidResponses = [bidResponse]; + return bidResponses + } +}; + +registerBidder(spec); diff --git a/modules/docereeBidAdapter.md b/modules/docereeBidAdapter.md index 9e3d4bbe1b8..d977e11f40a 100644 --- a/modules/docereeBidAdapter.md +++ b/modules/docereeBidAdapter.md @@ -1,32 +1,33 @@ # Overview -Module Name: Doceree Bidder Adapter -Module Type: Bidder Adapter - -# Description +``` +Module Name: Doceree Bidder Adapter +Module Type: Bidder Adapter +Maintainer: sourbh.gupta@doceree.com +``` + Connects to Doceree demand source to fetch bids. -Please use ```doceree``` as the bidder code. +Please use ```doceree``` as the bidder code. + # Test Parameters ``` - var adUnits = [ +var adUnits = [ + { + code: 'doceree', + sizes: [ + [300, 250] + ], + bids: [ { - code: 'desktop-banner-ad-div', - sizes: [[300, 250]], - bids: [ - { - bidder: "doceree", - params: { - accountID: '167283', - zoneID: '445501', - domain: 'adbserver.doceree.com', - extra: { - tuid: '1234-abcd' - } - } - } - ] - }, - ]; + bidder: "doceree", + params: { + placementId: 'DOC_7jm9j5eqkl0xvc5w', //required + publisherUrl: document.URL || window.location.href, //optional + } + } + ] + } +]; ``` diff --git a/test/spec/modules/docereeBidAdapter_spec.js b/test/spec/modules/docereeBidAdapter_spec.js new file mode 100644 index 00000000000..18f79ce9c85 --- /dev/null +++ b/test/spec/modules/docereeBidAdapter_spec.js @@ -0,0 +1,93 @@ +import {expect} from 'chai'; +import {spec} from '../../../modules/docereeBidAdapter.js'; +import { config } from '../../../src/config.js'; + +describe('BidlabBidAdapter', function () { + config.setConfig({ + doceree: { + context: { + data: { + token: 'testing-token', // required + } + }, + user: { + data: { + gender: '', + email: '', + hashedEmail: '', + firstName: '', + lastName: '', + npi: '', + hashedNPI: '', + city: '', + zipCode: '', + specialization: '', + } + } + } + }); + let bid = { + bidId: 'testing', + bidder: 'doceree', + params: { + placementId: 'DOC_7jm9j5eqkl0xvc5w', + } + }; + + describe('isBidRequestValid', function () { + it('Should return true if placementId is present', function () { + expect(spec.isBidRequestValid(bid)).to.be.true; + }); + it('Should return false if placementId is not present', function () { + delete bid.params.placementId; + expect(spec.isBidRequestValid(bid)).to.be.false; + }); + }); + + describe('buildRequests', function () { + let serverRequest = spec.buildRequests([bid]); + serverRequest = serverRequest[0] + it('Creates a ServerRequest object with method, URL and data', function () { + expect(serverRequest).to.exist; + expect(serverRequest.method).to.exist; + expect(serverRequest.url).to.exist; + }); + it('Returns GET method', function () { + expect(serverRequest.method).to.equal('GET'); + }); + it('Returns valid URL', function () { + expect(serverRequest.url).to.equal('https://bidder.doceree.com/v1/adrequest?id=DOC_7jm9j5eqkl0xvc5w&pubRequestedURL=undefined&loggedInUser=JTdCJTIyZ2VuZGVyJTIyJTNBJTIyJTIyJTJDJTIyZW1haWwlMjIlM0ElMjIlMjIlMkMlMjJoYXNoZWRFbWFpbCUyMiUzQSUyMiUyMiUyQyUyMmZpcnN0TmFtZSUyMiUzQSUyMiUyMiUyQyUyMmxhc3ROYW1lJTIyJTNBJTIyJTIyJTJDJTIybnBpJTIyJTNBJTIyJTIyJTJDJTIyaGFzaGVkTlBJJTIyJTNBJTIyJTIyJTJDJTIyY2l0eSUyMiUzQSUyMiUyMiUyQyUyMnppcENvZGUlMjIlM0ElMjIlMjIlMkMlMjJzcGVjaWFsaXphdGlvbiUyMiUzQSUyMiUyMiU3RA%3D%3D&prebidjs=true&requestId=testing&'); + }); + }); + describe('interpretResponse', function () { + it('Should interpret banner response', function () { + const banner = { + body: { + DIVID: 'DOC_7jm9j5eqkl0xvc5w', + creativeType: 'banner', + guid: 'G125fzC5NKl3FHeOT8yvL98ILfQS9TVUgk6Q', + currency: 'USD', + cpmBid: 2, + height: '250', + width: '300', + ctaLink: 'https://doceree.com/', + sourceURL: 'https://servedbydoceree.doceree.com/generic/300x250_DocereeGeneralAd.jpg', + } + }; + let bannerResponses = spec.interpretResponse(banner); + expect(bannerResponses).to.be.an('array').that.is.not.empty; + let dataItem = bannerResponses[0]; + expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', + 'netRevenue', 'currency', 'mediaType', 'creativeId'); + expect(dataItem.requestId).to.equal('G125fzC5NKl3FHeOT8yvL98ILfQS9TVUgk6Q'); + expect(dataItem.cpm).to.equal(2); + expect(dataItem.width).to.equal(300); + expect(dataItem.height).to.equal(250); + expect(dataItem.ad).to.equal(''); + expect(dataItem.ttl).to.equal(30); + expect(dataItem.netRevenue).to.be.true; + expect(dataItem.currency).to.equal('USD'); + expect(dataItem.creativeId).to.equal('DOC_7jm9j5eqkl0xvc5w'); + }); + }) +}); From b0abd0cc5aefed0aa083c36c120276492d8aeeb8 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 14:54:24 +0530 Subject: [PATCH 02/11] add fix for impression register --- modules/docereeBidAdapter.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index 598231067a9..54cea6d6dc4 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -6,10 +6,19 @@ import { BANNER } from '../src/mediaTypes.js'; const BIDDER_CODE = 'doceree'; const END_POINT = 'https://bidder.doceree.com' +function registerImpression(responseJson) { + if (responseJson.impressionLink) { + ajax(responseJson.impressionLink, function() { + // nothing to do + }, null, {method: 'GET', customHeaders: {'Content-type': 'application/json; charset=utf-8'}}); + } +} + function processHTMLAndRender(responseJson, creativeHtml) { if (responseJson.sourceURL) { creativeHtml = creativeHtml.replace('', ``); } + creativeHtml = creativeHtml.replace(' -1) { @@ -73,23 +82,28 @@ export const spec = { responseJson.sourceHTML = responseJson.sourceHTML.replace(/[\uE000-\uF8FF]/g, ''); let creative = processHTMLAndRender(responseJson, responseJson.sourceHTML) bidResponse.ad = `
${creative}
` + var bidResponses = [bidResponse]; + return bidResponses } else { - ajax(responseJson.sourceURL, function(error, creativeHtml) { - if (!error) { + ajax(responseJson.sourceURL, function(creativeHtml, error) { + if (creativeHtml) { let creative = processHTMLAndRender(responseJson, creativeHtml) bidResponse.ad = `
${creative}
` + var bidResponses = [bidResponse]; + return bidResponses } }, null, {method: 'GET', customHeaders: {'Content-type': 'plain/html; charset=utf-8'}}); } } else { if (responseJson.ctaLink) { - bidResponse.ad = ``; + bidResponse.ad = ``; } else { - bidResponse.ad = `
`; + bidResponse.ad = `
`; } + var bidResponses = [bidResponse]; + return bidResponses } - var bidResponses = [bidResponse]; - return bidResponses + } }; From 9d58213a4b16ddb5be34b4aa92fe4ff25421d6f7 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 15:12:03 +0530 Subject: [PATCH 03/11] fix linting issues --- modules/docereeBidAdapter.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index 54cea6d6dc4..f77ad40b827 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -82,17 +82,8 @@ export const spec = { responseJson.sourceHTML = responseJson.sourceHTML.replace(/[\uE000-\uF8FF]/g, ''); let creative = processHTMLAndRender(responseJson, responseJson.sourceHTML) bidResponse.ad = `
${creative}
` - var bidResponses = [bidResponse]; - return bidResponses } else { - ajax(responseJson.sourceURL, function(creativeHtml, error) { - if (creativeHtml) { - let creative = processHTMLAndRender(responseJson, creativeHtml) - bidResponse.ad = `
${creative}
` - var bidResponses = [bidResponse]; - return bidResponses - } - }, null, {method: 'GET', customHeaders: {'Content-type': 'plain/html; charset=utf-8'}}); + bidResponse.ad = `` } } else { if (responseJson.ctaLink) { @@ -100,10 +91,8 @@ export const spec = { } else { bidResponse.ad = `
`; } - var bidResponses = [bidResponse]; - return bidResponses } - + return [bidResponse]; } }; From 63b83fa6e0e63eb53eae8fb0246e56e303e6e85b Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 15:40:26 +0530 Subject: [PATCH 04/11] fix build issue --- modules/docereeBidAdapter.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index f77ad40b827..78ddbab9b52 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -7,13 +7,16 @@ const BIDDER_CODE = 'doceree'; const END_POINT = 'https://bidder.doceree.com' function registerImpression(responseJson) { - if (responseJson.impressionLink) { - ajax(responseJson.impressionLink, function() { - // nothing to do - }, null, {method: 'GET', customHeaders: {'Content-type': 'application/json; charset=utf-8'}}); - } + return (function(){ + if (responseJson.impressionLink) { + ajax(responseJson.impressionLink, function() { + // nothing to do + }, null, {method: 'GET', customHeaders: {'Content-type': 'application/json; charset=utf-8'}}); + } + })() } + function processHTMLAndRender(responseJson, creativeHtml) { if (responseJson.sourceURL) { creativeHtml = creativeHtml.replace('', ``); From f2706c96e11c915a83f7d5957ec017c09884e546 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 15:57:30 +0530 Subject: [PATCH 05/11] remove extra spaces --- modules/docereeBidAdapter.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index 78ddbab9b52..5aa9f422c16 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -7,7 +7,7 @@ const BIDDER_CODE = 'doceree'; const END_POINT = 'https://bidder.doceree.com' function registerImpression(responseJson) { - return (function(){ + return (function() { if (responseJson.impressionLink) { ajax(responseJson.impressionLink, function() { // nothing to do @@ -16,7 +16,6 @@ function registerImpression(responseJson) { })() } - function processHTMLAndRender(responseJson, creativeHtml) { if (responseJson.sourceURL) { creativeHtml = creativeHtml.replace('', ``); From 88d0cda9391b14e791ff7ff60b46a734eb3c10bf Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 16:38:51 +0530 Subject: [PATCH 06/11] fixing - Implicit operand conversion --- modules/docereeBidAdapter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index 5aa9f422c16..b3fa5a35a65 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -13,6 +13,7 @@ function registerImpression(responseJson) { // nothing to do }, null, {method: 'GET', customHeaders: {'Content-type': 'application/json; charset=utf-8'}}); } + return "" })() } From 3dd02582ae56a542ea9ce6acd15237288c8879ae Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 16:50:13 +0530 Subject: [PATCH 07/11] fixed ci/cd lint issue --- modules/docereeBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index b3fa5a35a65..3c171dbfde1 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -13,7 +13,7 @@ function registerImpression(responseJson) { // nothing to do }, null, {method: 'GET', customHeaders: {'Content-type': 'application/json; charset=utf-8'}}); } - return "" + return '' })() } From 4d0a50bf1bc65c76b79e0d9936f9070af55b95f9 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Fri, 19 Mar 2021 16:58:51 +0530 Subject: [PATCH 08/11] update test case --- test/spec/modules/docereeBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/docereeBidAdapter_spec.js b/test/spec/modules/docereeBidAdapter_spec.js index 18f79ce9c85..dad67e39083 100644 --- a/test/spec/modules/docereeBidAdapter_spec.js +++ b/test/spec/modules/docereeBidAdapter_spec.js @@ -83,7 +83,7 @@ describe('BidlabBidAdapter', function () { expect(dataItem.cpm).to.equal(2); expect(dataItem.width).to.equal(300); expect(dataItem.height).to.equal(250); - expect(dataItem.ad).to.equal(''); + expect(dataItem.ad).to.equal(''); expect(dataItem.ttl).to.equal(30); expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD'); From 622f7b156b87785f92af3e3cc64fa96cb2762cb0 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Mon, 22 Mar 2021 15:14:32 +0530 Subject: [PATCH 09/11] support for advertiserdomains and updated test case --- modules/docereeBidAdapter.js | 3 +++ test/spec/modules/docereeBidAdapter_spec.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index 3c171dbfde1..d6bc9915a07 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -78,6 +78,9 @@ export const spec = { currency: responseJson.currency, mediaType: 'banner', creativeId: placementId, + meta: { + advertiserDomains: [responseJson.advertiserDomain] + } }; if (responseJson.creativeType && responseJson.creativeType !== 'banner') { diff --git a/test/spec/modules/docereeBidAdapter_spec.js b/test/spec/modules/docereeBidAdapter_spec.js index dad67e39083..77f7eaea8cf 100644 --- a/test/spec/modules/docereeBidAdapter_spec.js +++ b/test/spec/modules/docereeBidAdapter_spec.js @@ -72,13 +72,14 @@ describe('BidlabBidAdapter', function () { width: '300', ctaLink: 'https://doceree.com/', sourceURL: 'https://servedbydoceree.doceree.com/generic/300x250_DocereeGeneralAd.jpg', + advertiserDomain: 'doceree.com', } }; let bannerResponses = spec.interpretResponse(banner); expect(bannerResponses).to.be.an('array').that.is.not.empty; let dataItem = bannerResponses[0]; expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', - 'netRevenue', 'currency', 'mediaType', 'creativeId'); + 'netRevenue', 'currency', 'mediaType', 'creativeId', 'meta'); expect(dataItem.requestId).to.equal('G125fzC5NKl3FHeOT8yvL98ILfQS9TVUgk6Q'); expect(dataItem.cpm).to.equal(2); expect(dataItem.width).to.equal(300); @@ -88,6 +89,8 @@ describe('BidlabBidAdapter', function () { expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD'); expect(dataItem.creativeId).to.equal('DOC_7jm9j5eqkl0xvc5w'); + expect(dataItem.meta.advertiserDomains).to.be.an('array').that.is.not.empty; + expect(dataItem.meta.advertiserDomains[0]).to.equal('doceree.com') }); }) }); From 61b93e6855c4040bfdfd25b9df599a958b76528c Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Mon, 22 Mar 2021 18:14:17 +0530 Subject: [PATCH 10/11] remove space to rerun test cases --- modules/docereeBidAdapter.js | 2 +- test/spec/modules/docereeBidAdapter_spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index d6bc9915a07..0ffee060b63 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -93,7 +93,7 @@ export const spec = { } } else { if (responseJson.ctaLink) { - bidResponse.ad = ``; + bidResponse.ad = ``; } else { bidResponse.ad = `
`; } diff --git a/test/spec/modules/docereeBidAdapter_spec.js b/test/spec/modules/docereeBidAdapter_spec.js index 77f7eaea8cf..2b32bf6a870 100644 --- a/test/spec/modules/docereeBidAdapter_spec.js +++ b/test/spec/modules/docereeBidAdapter_spec.js @@ -84,7 +84,7 @@ describe('BidlabBidAdapter', function () { expect(dataItem.cpm).to.equal(2); expect(dataItem.width).to.equal(300); expect(dataItem.height).to.equal(250); - expect(dataItem.ad).to.equal(''); + expect(dataItem.ad).to.equal(''); expect(dataItem.ttl).to.equal(30); expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD'); From c3fe4e55bf3031e54d7155e32d9a168fce9b4441 Mon Sep 17 00:00:00 2001 From: sourbh-doceree Date: Thu, 25 Mar 2021 16:51:36 +0530 Subject: [PATCH 11/11] remove the client side creative creation --- modules/docereeBidAdapter.js | 42 +-------------------- test/spec/modules/docereeBidAdapter_spec.js | 5 ++- 2 files changed, 4 insertions(+), 43 deletions(-) diff --git a/modules/docereeBidAdapter.js b/modules/docereeBidAdapter.js index 0ffee060b63..f9f3e1bcc70 100644 --- a/modules/docereeBidAdapter.js +++ b/modules/docereeBidAdapter.js @@ -1,35 +1,10 @@ import * as utils from '../src/utils.js'; -import { ajax } from '../src/ajax.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; import { config } from '../src/config.js'; import { BANNER } from '../src/mediaTypes.js'; const BIDDER_CODE = 'doceree'; const END_POINT = 'https://bidder.doceree.com' -function registerImpression(responseJson) { - return (function() { - if (responseJson.impressionLink) { - ajax(responseJson.impressionLink, function() { - // nothing to do - }, null, {method: 'GET', customHeaders: {'Content-type': 'application/json; charset=utf-8'}}); - } - return '' - })() -} - -function processHTMLAndRender(responseJson, creativeHtml) { - if (responseJson.sourceURL) { - creativeHtml = creativeHtml.replace('', ``); - } - creativeHtml = creativeHtml.replace(' -1) { - creativeHtml = creativeHtml.replace('_ucid', utils.generateUUID()) - } - return creativeHtml; -} - export const spec = { code: BIDDER_CODE, url: '', @@ -69,6 +44,7 @@ export const spec = { const responseJson = serverResponse ? serverResponse.body : {}; const placementId = responseJson.DIVID; const bidResponse = { + ad: responseJson.sourceHTML, width: Number(responseJson.width), height: Number(responseJson.height), requestId: responseJson.guid, @@ -82,22 +58,6 @@ export const spec = { advertiserDomains: [responseJson.advertiserDomain] } }; - - if (responseJson.creativeType && responseJson.creativeType !== 'banner') { - if (responseJson.sourceHTML) { - responseJson.sourceHTML = responseJson.sourceHTML.replace(/[\uE000-\uF8FF]/g, ''); - let creative = processHTMLAndRender(responseJson, responseJson.sourceHTML) - bidResponse.ad = `
${creative}
` - } else { - bidResponse.ad = `` - } - } else { - if (responseJson.ctaLink) { - bidResponse.ad = ``; - } else { - bidResponse.ad = `
`; - } - } return [bidResponse]; } }; diff --git a/test/spec/modules/docereeBidAdapter_spec.js b/test/spec/modules/docereeBidAdapter_spec.js index 2b32bf6a870..efff2efa319 100644 --- a/test/spec/modules/docereeBidAdapter_spec.js +++ b/test/spec/modules/docereeBidAdapter_spec.js @@ -71,7 +71,8 @@ describe('BidlabBidAdapter', function () { height: '250', width: '300', ctaLink: 'https://doceree.com/', - sourceURL: 'https://servedbydoceree.doceree.com/generic/300x250_DocereeGeneralAd.jpg', + sourceURL: '', + sourceHTML: '
test
', advertiserDomain: 'doceree.com', } }; @@ -84,7 +85,7 @@ describe('BidlabBidAdapter', function () { expect(dataItem.cpm).to.equal(2); expect(dataItem.width).to.equal(300); expect(dataItem.height).to.equal(250); - expect(dataItem.ad).to.equal(''); + expect(dataItem.ad).to.equal('
test
'); expect(dataItem.ttl).to.equal(30); expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD');