From e55a333e722ff9976c387ea01e41b8f710cea157 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko Date: Wed, 25 Jun 2025 17:45:00 +0500 Subject: [PATCH 1/3] Corrects media type and ad rendering logic for bids Updates media type selection to rely on bid mtype instead of bin nurl presence, ensuring accurate banner and video handling. --- modules/sovrnBidAdapter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/sovrnBidAdapter.js b/modules/sovrnBidAdapter.js index 49d7924537f..79674b037d9 100644 --- a/modules/sovrnBidAdapter.js +++ b/modules/sovrnBidAdapter.js @@ -234,15 +234,15 @@ export const spec = { dealId: sovrnBid.dealid || null, currency: 'USD', netRevenue: true, - mediaType: sovrnBid.nurl ? BANNER : VIDEO, + mediaType: sovrnBid.mtype == 2 ? VIDEO : BANNER, ttl: sovrnBid.ext?.ttl || 90, meta: { advertiserDomains: sovrnBid && sovrnBid.adomain ? sovrnBid.adomain : [] } } - if (sovrnBid.nurl) { - bid.ad = decodeURIComponent(`${sovrnBid.adm}`) - } else { + if (sovrnBid.mtype == 2) { bid.vastXml = decodeURIComponent(sovrnBid.adm) + } else { + bid.ad = decodeURIComponent(`${sovrnBid.adm}`) } return bid From 4b3e4f73da034692c0338906e68b8fa96a520a88 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko Date: Wed, 25 Jun 2025 17:58:07 +0500 Subject: [PATCH 2/3] add unit test for media type selection --- test/spec/modules/sovrnBidAdapter_spec.js | 42 +++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/test/spec/modules/sovrnBidAdapter_spec.js b/test/spec/modules/sovrnBidAdapter_spec.js index 05d18a0bb98..176612442a3 100644 --- a/test/spec/modules/sovrnBidAdapter_spec.js +++ b/test/spec/modules/sovrnBidAdapter_spec.js @@ -763,7 +763,8 @@ describe('sovrnBidAdapter', function() { nurl: '', adm: 'key%3Dvalue', h: 480, - w: 640 + w: 640, + mtype: 2 } const bannerBid = { id: 'a_403370_332fdb9b064040ddbec05891bd13ab28', @@ -773,7 +774,8 @@ describe('sovrnBidAdapter', function() { nurl: '', adm: '', h: 90, - w: 728 + w: 728, + mtype: 1 } beforeEach(function () { @@ -789,6 +791,39 @@ describe('sovrnBidAdapter', function() { } }) + it('Should return the bid response of correct type when nurl is missing', function () { + const expectedResponse = { + requestId: '263c448586f5a1', + cpm: 0.45882675, + width: 728, + height: 90, + creativeId: 'creativelycreatedcreativecreative', + dealId: null, + currency: 'USD', + netRevenue: true, + mediaType: 'banner', + ttl: 60000, + meta: { advertiserDomains: [] }, + ad: decodeURIComponent(`>`) + } + + response = { + body: { + id: '37386aade21a71', + seatbid: [{ + bid: [{ + ...bannerBid, + nurl: '' + }] + }] + } + } + + const result = spec.interpretResponse(response) + + expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse)) + }) + it('should get the correct bid response', function () { const expectedResponse = { requestId: '263c448586f5a1', @@ -1072,7 +1107,8 @@ describe('sovrnBidAdapter', function() { nurl: '', adm: bidAdm, h: 480, - w: 640 + w: 640, + mtype: 2 }] }] } From 5f1b4fa0fcdafa1b845c35af0d8ca99e603f887b Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko Date: Fri, 27 Jun 2025 17:03:45 +0500 Subject: [PATCH 3/3] update creative processing logic --- modules/sovrnBidAdapter.js | 2 +- test/spec/modules/sovrnBidAdapter_spec.js | 34 ++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/modules/sovrnBidAdapter.js b/modules/sovrnBidAdapter.js index 79674b037d9..56f51ccdebb 100644 --- a/modules/sovrnBidAdapter.js +++ b/modules/sovrnBidAdapter.js @@ -242,7 +242,7 @@ export const spec = { if (sovrnBid.mtype == 2) { bid.vastXml = decodeURIComponent(sovrnBid.adm) } else { - bid.ad = decodeURIComponent(`${sovrnBid.adm}`) + bid.ad = sovrnBid.nurl ? decodeURIComponent(`${sovrnBid.adm}`) : decodeURIComponent(sovrnBid.adm) } return bid diff --git a/test/spec/modules/sovrnBidAdapter_spec.js b/test/spec/modules/sovrnBidAdapter_spec.js index 176612442a3..3f5a1e52cda 100644 --- a/test/spec/modules/sovrnBidAdapter_spec.js +++ b/test/spec/modules/sovrnBidAdapter_spec.js @@ -804,7 +804,7 @@ describe('sovrnBidAdapter', function() { mediaType: 'banner', ttl: 60000, meta: { advertiserDomains: [] }, - ad: decodeURIComponent(`>`) + ad: decodeURIComponent(``) } response = { @@ -824,6 +824,38 @@ describe('sovrnBidAdapter', function() { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse)) }) + it('Should return the bid response of correct type when nurl is present', function () { + const expectedResponse = { + requestId: '263c448586f5a1', + cpm: 0.45882675, + width: 728, + height: 90, + creativeId: 'creativelycreatedcreativecreative', + dealId: null, + currency: 'USD', + netRevenue: true, + mediaType: 'banner', + ttl: 60000, + meta: { advertiserDomains: [] }, + ad: decodeURIComponent(`>`) + } + + response = { + body: { + id: '37386aade21a71', + seatbid: [{ + bid: [{ + ...bannerBid + }] + }] + } + } + + const result = spec.interpretResponse(response) + + expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse)) + }) + it('should get the correct bid response', function () { const expectedResponse = { requestId: '263c448586f5a1',