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

Appnexus adapter: Added dealPriority and dealCode to bidResponse #3201

Merged
merged 4 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ function newBid(serverBid, rtbBid, bidderRequest) {
}
};

if (rtbBid.deal_priority && rtbBid.deal_code) {
Object.assign(bid, {
dealPriority: rtbBid.deal_priority,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we define all bid properties somewhere? Perhaps bidfactory.js

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common jsdoc bid properties are here https://github.com/prebid/Prebid.js/blob/master/src/adapters/bidderFactory.js#L89

We can add what appnexus returns in adapter.

dealCode: rtbBid.deal_code
});
}

if (rtbBid.rtb.video) {
Object.assign(bid, {
width: rtbBid.rtb.video.player_width,
Expand Down
10 changes: 10 additions & 0 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,5 +561,15 @@ describe('AppNexusAdapter', function () {
bidderRequest.bids[0].renderer.options
);
});

it('should add deal_priority and deal_code', function() {
let responseWithDeal = deepClone(response);
responseWithDeal.tags[0].ads[0].deal_priority = 'high';
responseWithDeal.tags[0].ads[0].deal_code = '123';

let bidderRequest;
let result = spec.interpretResponse({ body: responseWithDeal }, {bidderRequest});
expect(Object.keys(result[0])).to.include.members(['dealPriority', 'dealCode']);
});
});
});