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

XCH-2201: Add adomain support #38

Merged
merged 2 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 6 additions & 1 deletion modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ function interpretResponse(serverResponse, bidRequest) {

// All this assumes that only one bid is ever returned by ttx
function _createBidResponse(response) {
const isADomainPresent =
response.seatbid[0].bid[0].adomain && response.seatbid[0].bid[0].adomain.length;
const bid = {
requestId: response.id,
bidderCode: BIDDER_CODE,
Expand All @@ -579,7 +581,10 @@ function _createBidResponse(response) {
creativeId: response.seatbid[0].bid[0].crid,
mediaType: utils.deepAccess(response.seatbid[0].bid[0], 'ext.ttx.mediaType', BANNER),
currency: response.cur,
netRevenue: true
netRevenue: true,
...(isADomainPresent
carlosfelix marked this conversation as resolved.
Show resolved Hide resolved
? { meta: { advertiserDomains: response.seatbid[0].bid[0].adomain } }
: {})
}

if (bid.mediaType === VIDEO) {
Expand Down
56 changes: 52 additions & 4 deletions test/spec/modules/33acrossBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,8 @@ describe('33acrossBidAdapter:', function () {
crid: 1,
h: 250,
w: 300,
price: 0.0938
price: 0.0938,
adomain: ['advertiserdomain.com']
}]
}
]
Expand All @@ -1430,7 +1431,10 @@ describe('33acrossBidAdapter:', function () {
creativeId: 1,
mediaType: 'banner',
currency: 'USD',
netRevenue: true
netRevenue: true,
meta: {
advertiserDomains: ['advertiserdomain.com']
}
};

expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal([bidResponse]);
Expand All @@ -1456,7 +1460,8 @@ describe('33acrossBidAdapter:', function () {
crid: 1,
h: 250,
w: 300,
price: 0.0938
price: 0.0938,
adomain: ['advertiserdomain.com']
}]
}
]
Expand All @@ -1473,11 +1478,54 @@ describe('33acrossBidAdapter:', function () {
mediaType: 'video',
currency: 'USD',
netRevenue: true,
vastXml: videoBid
vastXml: videoBid,
meta: {
advertiserDomains: ['advertiserdomain.com']
}
};

expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal([bidResponse]);
});

context('when the list of advertiser domains for block list checking is empty', function() {
it('doesn\'t include the empty list in the interpreted response', function() {
const serverResponse = {
cur: 'USD',
ext: {},
id: 'b1',
seatbid: [
{
bid: [{
id: '1',
adm: '<html><h3>I am an ad</h3></html>',
crid: 1,
h: 250,
w: 300,
price: 0.0938,
adomain: [] // Empty list
}]
}
]
};

// Bid response below doesn't contain meta.advertiserDomains
const bidResponse = {
requestId: 'b1',
bidderCode: BIDDER_CODE,
cpm: 0.0938,
width: 300,
height: 250,
ad: '<html><h3>I am an ad</h3></html>',
ttl: 60,
creativeId: 1,
mediaType: 'banner',
currency: 'USD',
netRevenue: true
};

expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal([bidResponse]);
});
});
});

context('when no bids are returned', function() {
Expand Down