Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adnuntius Bid Adapter: Fix for bid too low. #6557

Merged
merged 4 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export const spec = {
const adUnit = serverBody.adUnits[k]
if (adUnit.matchedAdCount > 0) {
const bid = adUnit.ads[0];
const effectiveCpm = (bid.cpc && bid.cpm) ? bid.bid.amount + bid.cpm.amount : (bid.cpc) ? bid.bid.amount : (bid.cpm) ? bid.cpm.amount : 0;
bidResponses.push({
requestId: bidRequest.bid[k].bidId,
cpm: (bid.bid) ? bid.bid.amount : 0,
cpm: effectiveCpm,
width: Number(bid.creativeWidth),
height: Number(bid.creativeHeight),
creativeId: bid.creativeId,
Expand Down
8 changes: 5 additions & 3 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('adnuntiusBidAdapter', function () {
'destination': 'http://google.com'
},
'cpm': { 'amount': 5.0, 'currency': 'NOK' },
'bid': { 'amount': 5.0, 'currency': 'NOK' },
'cost': { 'amount': 5.0, 'currency': 'NOK' },
'bid': { 'amount': 0.005, 'currency': 'NOK' },
'cost': { 'amount': 0.005, 'currency': 'NOK' },
'impressionTrackingUrls': [],
'impressionTrackingUrlsEsc': [],
'adId': 'adn-id-1347343135',
Expand Down Expand Up @@ -106,12 +106,14 @@ describe('adnuntiusBidAdapter', function () {
const request = spec.buildRequests(bidRequests);
const interpretedResponse = spec.interpretResponse(serverResponse, request[0]);
const ad = serverResponse.body.adUnits[0].ads[0]
const cpm = (ad.cpc && ad.cpm) ? ad.bid.amount + ad.cpm.amount : (ad.cpm) ? ad.cpm.amount : 0;

expect(interpretedResponse).to.have.lengthOf(1);
expect(interpretedResponse[0].cpm).to.equal(ad.cpm.amount);
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);
expect(interpretedResponse[0].currency).to.equal(ad.cpm.currency);
expect(interpretedResponse[0].currency).to.equal(ad.bid.currency);
expect(interpretedResponse[0].netRevenue).to.equal(false);
expect(interpretedResponse[0].ad).to.equal(serverResponse.body.adUnits[0].html);
expect(interpretedResponse[0].ttl).to.equal(360);
Expand Down