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

PulsePoint Adapter - update for ttl logic #4400

Merged
merged 35 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2fba6a2
ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
anand-venkatraman Oct 14, 2016
ca17acb
Merge remote-tracking branch 'upstream/master'
anand-venkatraman Oct 25, 2016
5da43c3
Adding bidRequest to bidFactory.createBid method as per https://githu…
anand-venkatraman Oct 25, 2016
cf41114
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Nov 8, 2016
62756a9
ET-1765: Adding support for additional params in PulsePoint adapter (#2)
anand-venkatraman Nov 9, 2016
f8fabb7
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Dec 8, 2016
b9af15c
ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
anand-venkatraman Dec 8, 2016
6523c25
Merge pull request #3 from pulsepointinc/ET-1850
anand-venkatraman Dec 8, 2016
b5eeb7f
Minor fix
anand-venkatraman Dec 8, 2016
0f33ef5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 1, 2017
b5dbd34
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jun 27, 2017
d6fcd11
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jul 17, 2017
fce16ad
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Aug 15, 2017
9833867
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Sep 22, 2017
70924c5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Oct 12, 2017
41f4aca
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Nov 13, 2017
aae98a7
Adding mandatory parameters to Bid
anand-venkatraman Nov 13, 2017
6d546ed
Merge from upstream
anand-venkatraman Nov 27, 2017
a04a18f
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 7, 2018
467e9e3
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Apr 20, 2018
af1b3db
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Apr 30, 2018
a438b67
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 4, 2018
e2fa8c3
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 21, 2018
6db9eb4
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 22, 2018
92a6034
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 29, 2018
2195429
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jan 21, 2019
c0e32d5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 18, 2019
832976a
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 30, 2019
b780838
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jun 19, 2019
07ccd3d
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jul 10, 2019
8b5815f
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jul 15, 2019
3d0dcc2
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 1, 2019
4f24443
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 30, 2019
ca89cb3
Using the TTL from the bid.ext
anand-venkatraman Oct 30, 2019
163ae07
Minor refactor
anand-venkatraman Oct 30, 2019
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: 2 additions & 11 deletions modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function bidResponseAvailable(request, response) {
creative_id: idToBidMap[id].crid,
creativeId: idToBidMap[id].crid,
adId: id,
ttl: DEFAULT_BID_TTL,
ttl: idToBidMap[id].exp || DEFAULT_BID_TTL,
netRevenue: DEFAULT_NET_REVENUE,
currency: DEFAULT_CURRENCY
currency: idToBidMap[id].cur || DEFAULT_CURRENCY
};
if (idToImpMap[id]['native']) {
bid['native'] = nativeResponse(idToImpMap[id], idToBidMap[id]);
Expand All @@ -135,21 +135,12 @@ function bidResponseAvailable(request, response) {
bid.width = idToImpMap[id].banner.w;
bid.height = idToImpMap[id].banner.h;
}
applyExt(bid, idToBidMap[id])
bids.push(bid);
}
});
return bids;
}

function applyExt(bid, ortbBid) {
if (ortbBid && ortbBid.ext) {
bid.ttl = ortbBid.ext.ttl || bid.ttl;
bid.currency = ortbBid.ext.currency || bid.currency;
bid.netRevenue = ortbBid.ext.netRevenue != null ? ortbBid.ext.netRevenue : bid.netRevenue;
}
}

/**
* Produces an OpenRTBImpression from a slot config.
*/
Expand Down
31 changes: 20 additions & 11 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,30 +200,39 @@ describe('PulsePoint Adapter Tests', function () {
expect(bid.ttl).to.equal(20);
});

it('Verify use ttl in ext', function () {
it('Verify ttl/currency applied to bid', function () {
const request = spec.buildRequests(slotConfigs, bidderRequest);
const ortbRequest = request.data;
const ortbResponse = {
seatbid: [{
bid: [{
impid: ortbRequest.imp[0].id,
price: 1.25,
adm: 'This is an Ad',
ext: {
ttl: 30,
netRevenue: false,
currency: 'INR'
}
adm: 'This is an Ad#1',
crid: 'Creative#123',
exp: 50,
cur: 'GBP'
}, {
impid: ortbRequest.imp[1].id,
price: 1.25,
adm: 'This is an Ad#2',
crid: 'Creative#123'
}]
}]
};
const bids = spec.interpretResponse({ body: ortbResponse }, request);
expect(bids).to.have.lengthOf(1);
expect(bids).to.have.lengthOf(2);
// verify first bid
const bid = bids[0];
expect(bid.ttl).to.equal(30);
expect(bid.netRevenue).to.equal(false);
expect(bid.currency).to.equal('INR');
expect(bid.cpm).to.equal(1.25);
expect(bid.ad).to.equal('This is an Ad#1');
expect(bid.ttl).to.equal(50);
expect(bid.currency).to.equal('GBP');
const secondBid = bids[1];
expect(secondBid.cpm).to.equal(1.25);
expect(secondBid.ad).to.equal('This is an Ad#2');
expect(secondBid.ttl).to.equal(20);
expect(secondBid.currency).to.equal('USD');
});

it('Verify full passback', function () {
Expand Down