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 Bid Adapter: Support for schain #4433

Merged
merged 39 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 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
cf94b55
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 31, 2019
77aeec2
ET-5938 SupplyChain Object Support
mpashka Nov 6, 2019
ba9e16a
Formatting
mpashka Nov 6, 2019
9126c79
Code review
mpashka Nov 7, 2019
48f8dcd
Code review
mpashka Nov 7, 2019
6565818
Fix to currency parsing on response
anand-venkatraman Nov 7, 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
15 changes: 14 additions & 1 deletion modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const spec = {
badv: bidRequests[0].params.badv,
user: user(bidRequests[0], bidderRequest),
regs: regs(bidderRequest),
source: source(bidRequests[0].schain),
};
return {
method: 'POST',
Expand Down Expand Up @@ -116,7 +117,7 @@ function bidResponseAvailable(request, response) {
adId: id,
ttl: idToBidMap[id].exp || DEFAULT_BID_TTL,
netRevenue: DEFAULT_NET_REVENUE,
currency: idToBidMap[id].cur || DEFAULT_CURRENCY
currency: bidResponse.cur || DEFAULT_CURRENCY
};
if (idToImpMap[id]['native']) {
bid['native'] = nativeResponse(idToImpMap[id], idToBidMap[id]);
Expand Down Expand Up @@ -428,6 +429,18 @@ function regs(bidderRequest) {
return null;
}

/**
* Creates source object with supply chain
*/
function source(schain) {
if (schain) {
return {
ext: { schain }
};
}
return null;
}

/**
* Parses the native response from the Bid given.
*/
Expand Down
56 changes: 52 additions & 4 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,35 @@ describe('PulsePoint Adapter Tests', function () {
}
}
}];

const schainParamsSlotConfig = [{
placementCode: '/DfpAccount1/slot1',
bidId: 'bid12345',
params: {
cp: 'p10000',
ct: 't10000',
cf: '1x1',
bcat: ['IAB-1', 'IAB-20'],
battr: [1, 2, 3],
bidfloor: 1.5,
badv: ['cocacola.com', 'lays.com']
},
schain: {
'ver': '1.0',
'complete': 1,
'nodes': [
{
'asi': 'exchange1.com',
'sid': '1234',
'hp': 1,
'rid': 'bid-request-1',
'name': 'publisher',
'domain': 'publisher.com'
}
]
},
}];

const bidderRequest = {
refererInfo: {
referer: 'https://publisher.com/home'
Expand Down Expand Up @@ -210,15 +239,15 @@ describe('PulsePoint Adapter Tests', function () {
price: 1.25,
adm: 'This is an Ad#1',
crid: 'Creative#123',
exp: 50,
cur: 'GBP'
exp: 50
}, {
impid: ortbRequest.imp[1].id,
price: 1.25,
adm: 'This is an Ad#2',
crid: 'Creative#123'
}]
}]
}],
cur: 'GBP'
};
const bids = spec.interpretResponse({ body: ortbResponse }, request);
expect(bids).to.have.lengthOf(2);
Expand All @@ -232,7 +261,7 @@ describe('PulsePoint Adapter Tests', function () {
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');
expect(secondBid.currency).to.equal('GBP');
});

it('Verify full passback', function () {
Expand Down Expand Up @@ -485,6 +514,25 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.imp[1].ext).to.be.null;
});

it('Verify schain parameters', function () {
const request = spec.buildRequests(schainParamsSlotConfig, bidderRequest);
const ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.source).to.not.equal(null);
expect(ortbRequest.source.ext).to.not.equal(null);
expect(ortbRequest.source.ext.schain).to.not.equal(null);
expect(ortbRequest.source.ext.schain.complete).to.equal(1);
expect(ortbRequest.source.ext.schain.ver).to.equal('1.0');
expect(ortbRequest.source.ext.schain.nodes).to.not.equal(null);
expect(ortbRequest.source.ext.schain.nodes).to.lengthOf(1);
expect(ortbRequest.source.ext.schain.nodes[0].asi).to.equal('exchange1.com');
expect(ortbRequest.source.ext.schain.nodes[0].sid).to.equal('1234');
expect(ortbRequest.source.ext.schain.nodes[0].hp).to.equal(1);
expect(ortbRequest.source.ext.schain.nodes[0].rid).to.equal('bid-request-1');
expect(ortbRequest.source.ext.schain.nodes[0].name).to.equal('publisher');
expect(ortbRequest.source.ext.schain.nodes[0].domain).to.equal('publisher.com');
});

it('Verify outstream renderer', function () {
const bidderRequestOutstream = Object.assign({}, bidderRequest, {bids: [outstreamSlotConfig[0]]});
const request = spec.buildRequests(outstreamSlotConfig, bidderRequestOutstream);
Expand Down