diff --git a/modules/admaticBidAdapter.js b/modules/admaticBidAdapter.js index 1b8b8752235..a5ebe91f98a 100644 --- a/modules/admaticBidAdapter.js +++ b/modules/admaticBidAdapter.js @@ -12,7 +12,7 @@ import {getUserSyncParams} from '../libraries/userSyncUtils/userSyncUtils.js'; */ export const OPENRTB = { - NATIVE: { + N: { IMAGE_TYPE: { ICON: 1, MAIN: 3, @@ -74,7 +74,6 @@ export const spec = { const ortb = bidderRequest.ortb2; const networkId = getValue(validBidRequests[0].params, 'networkId'); const host = getValue(validBidRequests[0].params, 'host'); - const currency = config.getConfig('currency.adServerCurrency') || 'TRY'; const bidderName = validBidRequests[0].bidder; const payload = { @@ -89,7 +88,6 @@ export const spec = { }, imp: bids, ext: { - cur: currency, bidder: bidderName }, schain: {}, @@ -104,6 +102,10 @@ export const spec = { tmax: parseInt(tmax) }; + if (config.getConfig('currency.adServerCurrency')) { + payload.ext.cur = config.getConfig('currency.adServerCurrency'); + } + if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) { const consentStr = (bidderRequest.gdprConsent.consentString) ? bidderRequest.gdprConsent.consentString.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '') : ''; @@ -189,7 +191,7 @@ export const spec = { cpm: bid.price, width: bid.width, height: bid.height, - currency: body.cur || 'TRY', + currency: body.cur, netRevenue: true, creativeId: bid.creative_id, meta: { @@ -414,30 +416,30 @@ function interpretNativeAd(adm) { }; native.assets.forEach(asset => { switch (asset.id) { - case OPENRTB.NATIVE.ASSET_ID.TITLE: + case OPENRTB.N.ASSET_ID.TITLE: result.title = asset.title.text; break; - case OPENRTB.NATIVE.ASSET_ID.IMAGE: + case OPENRTB.N.ASSET_ID.IMAGE: result.image = { url: encodeURI(asset.img.url), width: asset.img.w, height: asset.img.h }; break; - case OPENRTB.NATIVE.ASSET_ID.ICON: + case OPENRTB.N.ASSET_ID.ICON: result.icon = { url: encodeURI(asset.img.url), width: asset.img.w, height: asset.img.h }; break; - case OPENRTB.NATIVE.ASSET_ID.BODY: + case OPENRTB.N.ASSET_ID.BODY: result.body = asset.data.value; break; - case OPENRTB.NATIVE.ASSET_ID.SPONSORED: + case OPENRTB.N.ASSET_ID.SPONSORED: result.sponsoredBy = asset.data.value; break; - case OPENRTB.NATIVE.ASSET_ID.CTA: + case OPENRTB.N.ASSET_ID.CTA: result.cta = asset.data.value; break; } diff --git a/test/spec/modules/admaticBidAdapter_spec.js b/test/spec/modules/admaticBidAdapter_spec.js index 8730f2c1a0d..50700a7b4e1 100644 --- a/test/spec/modules/admaticBidAdapter_spec.js +++ b/test/spec/modules/admaticBidAdapter_spec.js @@ -802,6 +802,7 @@ describe('admaticBidAdapter', () => { 'price': 0.01, 'type': 'banner', 'bidder': 'admatic', + 'currency': 'TRY', 'mime_type': { 'name': 'backfill', 'force': false @@ -816,6 +817,7 @@ describe('admaticBidAdapter', () => { 'width': 300, 'height': 250, 'price': 0.01, + 'currency': 'TRY', 'type': 'video', 'mime_type': { 'name': 'backfill', @@ -832,6 +834,7 @@ describe('admaticBidAdapter', () => { 'width': 1, 'height': 1, 'price': 0.01, + 'currency': 'TRY', 'type': 'native', 'mime_type': { 'name': 'backfill', @@ -843,6 +846,7 @@ describe('admaticBidAdapter', () => { 'iurl': 'https://www.admatic.com.tr' } ], + 'cur': 'TRY', 'queryId': 'cdnbh24rlv0hhkpfpln0', 'status': true }}; @@ -853,9 +857,9 @@ describe('admaticBidAdapter', () => { cpm: 0.01, width: 300, height: 250, - currency: 'TRY', mediaType: 'banner', netRevenue: true, + currency: 'TRY', ad: '
', creativeId: '374', meta: { @@ -873,9 +877,9 @@ describe('admaticBidAdapter', () => { cpm: 0.01, width: 300, height: 250, - currency: 'TRY', mediaType: 'video', netRevenue: true, + currency: 'TRY', vastXml: '', creativeId: '3741', meta: { @@ -893,9 +897,9 @@ describe('admaticBidAdapter', () => { cpm: 0.01, width: 1, height: 1, - currency: 'TRY', mediaType: 'native', netRevenue: true, + currency: 'TRY', native: { 'clickUrl': 'https://www.admatic.com.tr', 'impressionTrackers': ['https://www.admatic.com.tr'], @@ -1144,7 +1148,8 @@ describe('admaticBidAdapter', () => { let bids = { body: { data: [], 'queryId': 'cdnbh24rlv0hhkpfpln0', - 'status': true + 'status': true, + 'cur': 'TRY' }}; let result = spec.interpretResponse(bids, {data: request});