diff --git a/integrationExamples/gpt/adnuntius_example.html b/integrationExamples/gpt/adnuntius_example.html
new file mode 100644
index 00000000000..b61c4e0674e
--- /dev/null
+++ b/integrationExamples/gpt/adnuntius_example.html
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+Adnuntius Prebid Adaptor Test
+Ad Slot 1
+
+
+
+
+
+
+
+
diff --git a/modules/adnuntiusBidAdapter.js b/modules/adnuntiusBidAdapter.js
index e44e2b1471a..a2b695e55e0 100644
--- a/modules/adnuntiusBidAdapter.js
+++ b/modules/adnuntiusBidAdapter.js
@@ -14,6 +14,7 @@ const ENDPOINT_URL_EUROPE = 'https://europe.delivery.adnuntius.com/i';
const GVLID = 855;
const DEFAULT_VAST_VERSION = 'vast4'
const MAXIMUM_DEALS_LIMIT = 5;
+const VALID_BID_TYPES = ['netBid', 'grossBid'];
const checkSegment = function (segment) {
if (isStr(segment)) return segment;
@@ -48,6 +49,10 @@ const getUsi = function (meta, ortb2, bidderRequest) {
return usi
}
+const validateBidType = function(bidTypeOption) {
+ return VALID_BID_TYPES.indexOf(bidTypeOption || '') > -1 ? bidTypeOption : 'bid';
+}
+
const AU_ID_REGEX = new RegExp('^[0-9A-Fa-f]{1,20}$');
export const spec = {
@@ -126,6 +131,15 @@ export const spec = {
interpretResponse: function (serverResponse, bidRequest) {
const adUnits = serverResponse.body.adUnits;
+ let validatedBidType = validateBidType(config.getConfig().bidType);
+ if (bidRequest.bid) {
+ bidRequest.bid.forEach(b => {
+ if (b.params && b.params.bidType) {
+ validatedBidType = validateBidType(b.params.bidType);
+ }
+ });
+ }
+
function buildAdResponse(bidderCode, ad, adUnit, dealCount) {
const destinationUrls = ad.destinationUrls || {};
const advertiserDomains = [];
@@ -135,7 +149,7 @@ export const spec = {
const adResponse = {
bidderCode: bidderCode,
requestId: adUnit.targetId,
- cpm: (ad.bid) ? ad.bid.amount * 1000 : 0,
+ cpm: ad[validatedBidType] ? ad[validatedBidType].amount * 1000 : 0,
width: Number(ad.creativeWidth),
height: Number(ad.creativeHeight),
creativeId: ad.creativeId,
diff --git a/test/spec/modules/adnuntiusBidAdapter_spec.js b/test/spec/modules/adnuntiusBidAdapter_spec.js
index 4ddbaaa2e2a..6a77c9205ca 100644
--- a/test/spec/modules/adnuntiusBidAdapter_spec.js
+++ b/test/spec/modules/adnuntiusBidAdapter_spec.js
@@ -99,7 +99,10 @@ describe('adnuntiusBidAdapter', function() {
const videoBidRequest = {
bid: videoBidderRequest,
- bidder: 'adnuntius'
+ bidder: 'adnuntius',
+ params: {
+ bidType: 'justsomestuff-error-handling'
+ }
}
const deals = [
@@ -749,12 +752,20 @@ describe('adnuntiusBidAdapter', function() {
describe('interpretResponse', function() {
it('should return valid response when passed valid server response', function() {
- const interpretedResponse = spec.interpretResponse(serverResponse, singleBidRequest);
+ config.setBidderConfig({
+ bidders: ['adnuntius'],
+ config: {
+ bidType: 'netBid',
+ maxDeals: 1
+ }
+ });
+
+ const interpretedResponse = config.runWithBidder('adnuntius', () => spec.interpretResponse(serverResponse, singleBidRequest));
expect(interpretedResponse).to.have.lengthOf(2);
const deal = serverResponse.body.adUnits[0].deals[0];
expect(interpretedResponse[0].bidderCode).to.equal('adnuntius');
- expect(interpretedResponse[0].cpm).to.equal(deal.bid.amount * 1000);
+ expect(interpretedResponse[0].cpm).to.equal(deal.netBid.amount * 1000);
expect(interpretedResponse[0].width).to.equal(Number(deal.creativeWidth));
expect(interpretedResponse[0].height).to.equal(Number(deal.creativeHeight));
expect(interpretedResponse[0].creativeId).to.equal(deal.creativeId);
@@ -770,7 +781,7 @@ describe('adnuntiusBidAdapter', function() {
const ad = serverResponse.body.adUnits[0].ads[0];
expect(interpretedResponse[1].bidderCode).to.equal('adnuntius');
- expect(interpretedResponse[1].cpm).to.equal(ad.bid.amount * 1000);
+ expect(interpretedResponse[1].cpm).to.equal(ad.netBid.amount * 1000);
expect(interpretedResponse[1].width).to.equal(Number(ad.creativeWidth));
expect(interpretedResponse[1].height).to.equal(Number(ad.creativeHeight));
expect(interpretedResponse[1].creativeId).to.equal(ad.creativeId);
@@ -808,6 +819,9 @@ describe('adnuntiusBidAdapter', function() {
{
bidder: 'adn-alt',
bidId: 'adn-0000000000000551',
+ params: {
+ bidType: 'netBid'
+ }
}
]
};
@@ -818,7 +832,7 @@ describe('adnuntiusBidAdapter', function() {
const ad = serverResponse.body.adUnits[0].ads[0];
expect(interpretedResponse[0].bidderCode).to.equal('adn-alt');
- expect(interpretedResponse[0].cpm).to.equal(ad.bid.amount * 1000);
+ expect(interpretedResponse[0].cpm).to.equal(ad.netBid.amount * 1000);
expect(interpretedResponse[0].width).to.equal(Number(ad.creativeWidth));
expect(interpretedResponse[0].height).to.equal(Number(ad.creativeHeight));
expect(interpretedResponse[0].creativeId).to.equal(ad.creativeId);