Skip to content

Conversant Bid Adapter: handle paapi data in the response #15

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

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 12 additions & 1 deletion modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,18 @@ export const spec = {
* @return {Bid[]} An array of bids which were nested inside the server.
*/
interpretResponse: function(serverResponse, bidRequest) {
return converter.fromORTB({request: bidRequest.data, response: serverResponse.body});
const ortbBids = converter.fromORTB({request: bidRequest.data, response: serverResponse.body});
const ortbAuctionConfigs = deepAccess(serverResponse, 'body.ext.igi') || [];
const configs = ortbAuctionConfigs.flatMap(entry => {
return entry.igs.map(ig => ({...ig, bidId: entry.impid}));
});
if (configs.length > 0) {
return {
bids: ortbBids,
paapiAuctionConfigs: configs
};
}
return ortbBids;
},

/**
Expand Down
44 changes: 44 additions & 0 deletions test/spec/modules/conversantBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {expect} from 'chai';
import {spec, storage} from 'modules/conversantBidAdapter.js';
import * as utils from 'src/utils.js';
import {deepSetValue} from 'src/utils.js';
import {createEidsArray} from 'modules/userId/eids.js';
import {deepAccess} from 'src/utils';
// load modules that register ORTB processors
Expand Down Expand Up @@ -518,6 +519,49 @@ describe('Conversant adapter tests', function() {
}
});

it('Paapi', function() {
const paapi = [
{
impid: 'bid000',
igs: [
{
config: {
seller: 'https://paapi.ad.cpe.dotomi.com',
decisionLogicURL: 'https://paapi.ad.cpe.dotomi.com/js/decision-logic-component-seller.js',
interestGroupBuyers: [ 'https://cookieless-campaign.lab-00.retargetly.com' ],
perBuyerSignals: {
'https://cookieless-campaign.lab-00.retargetly.com': { 'tid': '123456789012341234' }
},
sellerSignals: {
networkRequestId: '717847096745883980',
transactionId: '717847096745883981',
siteId: '207693',
tid: 5,
supplyTypeId: 1,
partnerId: 'Prebid.js',
partnerVersion: '1.2.3',
placementId: '10145350'
}
}
}
]
}];
const request = spec.buildRequests([bidRequests[0]], {});
let bidResponse = JSON.parse(JSON.stringify(bidResponses));
bidResponse.body.seatbid[0].bid = [bidResponses.body.seatbid[0].bid[0]];
deepSetValue(bidResponse, 'body.ext.igi', paapi);

debugger; //eslint-disable-line
const response = spec.interpretResponse(bidResponse, request);
const bid = response.bids[0];

expect(bid).to.have.property('requestId', 'bid000');
expect(response).to.have.property('paapiAuctionConfigs');
const paapiResponse = response.paapiAuctionConfigs[0];
expect(paapiResponse).to.have.property('bidId', paapi[0].impid);
expect(paapiResponse.config).to.deep.equal(paapi[0].igs[0].config);
});

it('Verify publisher commond id support', function() {
// clone bidRequests
let requests = utils.deepClone(bidRequests);
Expand Down