Skip to content

Commit 05f5977

Browse files
authored
Adds support for passing through deal IDs to adnuntius ad server. (#13410)
1 parent 981c0dd commit 05f5977

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

modules/adnuntiusBidAdapter.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ export const spec = {
394394
adUnit.nativeRequest = {ortb: mediaTypeData.ortb};
395395
}
396396
}
397+
const dealId = deepAccess(bid, 'params.dealId') || deepAccess(bid, 'params.inventory.pmp.deals');
398+
if (dealId) {
399+
// dealId at adserver accepts single string dealID and array
400+
adUnit.dealId = dealId;
401+
}
397402
const maxDeals = Math.max(0, Math.min(bid.params.maxDeals || 0, MAXIMUM_DEALS_LIMIT));
398403
if (maxDeals > 0) {
399404
adUnit.maxDeals = maxDeals;

test/spec/modules/adnuntiusBidAdapter_spec.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { config } from 'src/config.js';
55
import * as utils from 'src/utils.js';
66
import { getStorageManager } from 'src/storageManager.js';
77
import { getGlobal } from '../../../src/prebidGlobal.js';
8-
import { getUnixTimestampFromNow } from 'src/utils.js';
8+
import {deepClone, getUnixTimestampFromNow} from 'src/utils.js';
99
import { getWinDimensions } from '../../../src/utils';
1010

1111
describe('adnuntiusBidAdapter', function () {
@@ -965,6 +965,29 @@ describe('adnuntiusBidAdapter', function () {
965965
expectUrlsEqual(request[0].url, LOCALHOST_URL);
966966
});
967967

968+
it('Test specifying deal IDs', function () {
969+
const dealIdRequest = deepClone(bidderRequests);
970+
dealIdRequest[0].params.dealId = 'simplestringdeal';
971+
dealIdRequest[0].params.inventory = {
972+
pmp: {
973+
deals: [{id: '123', bidfloor: 12, bidfloorcur: 'USD'}]
974+
}
975+
};
976+
let request = spec.buildRequests(dealIdRequest, {});
977+
expect(request.length).to.equal(1);
978+
expect(request[0]).to.have.property('bid');
979+
const bid = request[0].bid[0]
980+
expect(bid).to.have.property('bidId');
981+
expect(request[0]).to.have.property('url');
982+
expectUrlsEqual(request[0].url, ENDPOINT_URL);
983+
expect(request[0]).to.have.property('data');
984+
expect(request[0].data).to.equal('{"adUnits":[{"auId":"000000000008b6bc","targetId":"123","dealId":"simplestringdeal","maxDeals":1,"dimensions":[[640,480],[600,400]]},{"auId":"0000000000000551","targetId":"adn-0000000000000551","dimensions":[[1640,1480],[1600,1400]]}]}');
985+
986+
delete dealIdRequest[0].params.dealId;
987+
request = spec.buildRequests(dealIdRequest, {});
988+
expect(request[0].data).to.equal('{"adUnits":[{"auId":"000000000008b6bc","targetId":"123","dealId":[{"id":"123","bidfloor":12,"bidfloorcur":"USD"}],"maxDeals":1,"dimensions":[[640,480],[600,400]]},{"auId":"0000000000000551","targetId":"adn-0000000000000551","dimensions":[[1640,1480],[1600,1400]]}]}');
989+
});
990+
968991
it('Test requests with no local storage', function () {
969992
storage.setDataInLocalStorage('adn.metaData', JSON.stringify([{}]));
970993
const request = spec.buildRequests(bidderRequests, {});

0 commit comments

Comments
 (0)