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

OpenX BidAdapter: remove PAF, bugfix for PAAPI igi support #12105

Merged
merged 1 commit into from
Aug 8, 2024
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
7 changes: 1 addition & 6 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ const converter = ortbConverter({
bidResponse.meta.advertiserId = bid.ext.buyer_id;
bidResponse.meta.brandId = bid.ext.brand_id;
}
const {ortbResponse} = context;
if (ortbResponse.ext && ortbResponse.ext.paf) {
bidResponse.meta.paf = Object.assign({}, ortbResponse.ext.paf);
bidResponse.meta.paf.content_id = utils.deepAccess(bid, 'ext.paf.content_id');
}
return bidResponse;
},
response(buildResponse, bidResponses, ortbResponse, context) {
Expand Down Expand Up @@ -117,7 +112,7 @@ const converter = ortbConverter({
paapi: fledgeAuctionConfigs,
}
} else {
return response.bids
return response
}
},
overrides: {
Expand Down
63 changes: 15 additions & 48 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ describe('OpenxRtbAdapter', function () {
let bid;

context('when there is an nbr response', function () {
let bids;
let response;
beforeEach(function () {
bidRequestConfigs = [{
bidder: 'openx',
Expand All @@ -1131,16 +1131,16 @@ describe('OpenxRtbAdapter', function () {
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];

bidResponse = {nbr: 0}; // Unknown error
bids = spec.interpretResponse({body: bidResponse}, bidRequest);
response = spec.interpretResponse({body: bidResponse}, bidRequest);
});

it('should not return any bids', function () {
expect(bids.length).to.equal(0);
expect(response.bids.length).to.equal(0);
});
});

context('when no seatbid in response', function () {
let bids;
let response;
beforeEach(function () {
bidRequestConfigs = [{
bidder: 'openx',
Expand All @@ -1162,16 +1162,16 @@ describe('OpenxRtbAdapter', function () {
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];

bidResponse = {ext: {}, id: 'test-bid-id'};
bids = spec.interpretResponse({body: bidResponse}, bidRequest);
response = spec.interpretResponse({body: bidResponse}, bidRequest);
});

it('should not return any bids', function () {
expect(bids.length).to.equal(0);
expect(response.bids.length).to.equal(0);
});
});

context('when there is no response', function () {
let bids;
let response;
beforeEach(function () {
bidRequestConfigs = [{
bidder: 'openx',
Expand All @@ -1193,11 +1193,11 @@ describe('OpenxRtbAdapter', function () {
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];

bidResponse = ''; // Unknown error
bids = spec.interpretResponse({body: bidResponse}, bidRequest);
response = spec.interpretResponse({body: bidResponse}, bidRequest);
});

it('should not return any bids', function () {
expect(bids.length).to.equal(0);
expect(response.bids.length).to.equal(0);
});
});

Expand Down Expand Up @@ -1232,19 +1232,11 @@ describe('OpenxRtbAdapter', function () {
ext: {
dsp_id: '123',
buyer_id: '456',
brand_id: '789',
paf: {
content_id: 'paf_content_id'
}
brand_id: '789'
}
}]
}],
cur: 'AUS',
ext: {
paf: {
transmission: {version: '12'}
}
}
cur: 'AUS'
};

context('when there is a response, the common response properties', function () {
Expand All @@ -1253,7 +1245,7 @@ describe('OpenxRtbAdapter', function () {
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
bidResponse = deepClone(SAMPLE_BID_RESPONSE);

bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
});

it('should return a price', function () {
Expand Down Expand Up @@ -1308,33 +1300,8 @@ describe('OpenxRtbAdapter', function () {
it('should return adomain', function () {
expect(bid.meta.advertiserDomains).to.equal(bidResponse.seatbid[0].bid[0].adomain);
});

it('should return paf fields', function () {
const paf = {
transmission: {version: '12'},
content_id: 'paf_content_id'
}
expect(bid.meta.paf).to.deep.equal(paf);
});
});

context('when there is more than one response', () => {
let bids;
beforeEach(function () {
bidRequestConfigs = deepClone(SAMPLE_BID_REQUESTS);
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
bidResponse = deepClone(SAMPLE_BID_RESPONSE);
bidResponse.seatbid[0].bid.push(deepClone(bidResponse.seatbid[0].bid[0]));
bidResponse.seatbid[0].bid[1].ext.paf.content_id = 'second_paf'

bids = spec.interpretResponse({body: bidResponse}, bidRequest);
});

it('should not confuse paf content_id', () => {
expect(bids.map(b => b.meta.paf.content_id)).to.eql(['paf_content_id', 'second_paf']);
});
})

context('when the response is a banner', function() {
beforeEach(function () {
bidRequestConfigs = [{
Expand Down Expand Up @@ -1371,7 +1338,7 @@ describe('OpenxRtbAdapter', function () {
cur: 'AUS'
};

bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
});

it('should return the proper mediaType', function () {
Expand Down Expand Up @@ -1420,14 +1387,14 @@ describe('OpenxRtbAdapter', function () {
});

it('should return the proper mediaType', function () {
bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
expect(bid.mediaType).to.equal(Object.keys(bidRequestConfigs[0].mediaTypes)[0]);
});

it('should return the proper mediaType', function () {
const winUrl = 'https//my.win.url';
bidResponse.seatbid[0].bid[0].nurl = winUrl
bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];

expect(bid.vastUrl).to.equal(winUrl);
});
Expand Down
Loading