Skip to content

Commit

Permalink
Reading pmp from ortb2Imp object (#12020)
Browse files Browse the repository at this point in the history
  • Loading branch information
kapil-tuptewar authored Jul 23, 2024
1 parent f658dbf commit 0c6b844
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,8 @@ function _createImpressionObject(bid, bidderRequest) {
},
bidfloorcur: bid.params.currency ? _parseSlotParam('currency', bid.params.currency) : DEFAULT_CURRENCY,
displaymanager: 'Prebid.js',
displaymanagerver: '$prebid.version$' // prebid version
displaymanagerver: '$prebid.version$', // prebid version
pmp: bid.ortb2Imp?.pmp || undefined
};

_addPMPDealsInImpression(impObj, bid);
Expand Down
18 changes: 18 additions & 0 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2974,6 +2974,24 @@ describe('PubMatic adapter', function () {
expect(data.device).to.include.any.keys('connectiontype');
}
});

it('should send imp.pmp in request if pmp json is present in adUnit ortb2Imp object', function () {
let originalBidRequests = utils.deepClone(bidRequests);
originalBidRequests[0].ortb2Imp.pmp = {
'private_auction': 0,
'deals': [{ 'id': '5678' }]
}
const bidRequest = spec.buildRequests(originalBidRequests);
let data = JSON.parse(bidRequest.data);
expect(data.imp[0].pmp).to.exist.and.to.be.an('object');
})

it('should not send imp.pmp in request if pmp json is not present in adUnit ortb2Imp object', function () {
let originalBidRequests = utils.deepClone(bidRequests);
const bidRequest = spec.buildRequests(originalBidRequests);
let data = JSON.parse(bidRequest.data);
expect(data.imp[0].pmp).to.deep.equal(undefined);
})
});

it('Request params dctr check', function () {
Expand Down

0 comments on commit 0c6b844

Please sign in to comment.