Skip to content

Commit

Permalink
TrustX adapter update (#1979)
Browse files Browse the repository at this point in the history
* Add trustx adapter and tests for it

* update integration example

* Update trustx adapter

* Post-review fixes of Trustx adapter

* Code improvement for trustx adapter: changed default price type from gross to net

* Update TrustX adapter to support the 1.0 version

* Make requested changes for TrustX adapter

* Updated markdown file for TrustX adapter

* Fix TrustX adapter and spec file

* Update TrustX adapter: r parameter was added to ad request as cache buster
  • Loading branch information
PWyrembak authored and jaiminpanchal27 committed Jan 3, 2018
1 parent 402877a commit 30dddf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/trustxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ export const spec = {
const bidsMap = {};
const bids = validBidRequests || [];
let priceType = 'net';
let reqId;

bids.forEach(bid => {
if (bid.params.priceType === 'gross') {
priceType = 'gross';
}
reqId = bid.bidderRequestId;
if (!bidsMap[bid.params.uid]) {
bidsMap[bid.params.uid] = [bid];
auids.push(bid.params.uid);
Expand All @@ -54,6 +56,7 @@ export const spec = {
u: utils.getTopWindowUrl(),
pt: priceType,
auids: auids.join(','),
r: reqId
};

return {
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/trustxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ describe('TrustXAdapter', function () {
expect(payload).to.have.property('u').that.is.a('string');
expect(payload).to.have.property('pt', 'net');
expect(payload).to.have.property('auids', '43');
expect(payload).to.have.property('r', '22edbae2733bf6');
});

it('auids must not be duplicated', () => {
Expand All @@ -91,6 +92,7 @@ describe('TrustXAdapter', function () {
expect(payload).to.have.property('u').that.is.a('string');
expect(payload).to.have.property('pt', 'net');
expect(payload).to.have.property('auids', '43,45');
expect(payload).to.have.property('r', '22edbae2733bf6');
});

it('pt parameter must be "gross" if params.priceType === "gross"', () => {
Expand All @@ -101,6 +103,7 @@ describe('TrustXAdapter', function () {
expect(payload).to.have.property('u').that.is.a('string');
expect(payload).to.have.property('pt', 'gross');
expect(payload).to.have.property('auids', '43,45');
expect(payload).to.have.property('r', '22edbae2733bf6');
delete bidRequests[1].params.priceType;
});

Expand All @@ -112,6 +115,7 @@ describe('TrustXAdapter', function () {
expect(payload).to.have.property('u').that.is.a('string');
expect(payload).to.have.property('pt', 'net');
expect(payload).to.have.property('auids', '43,45');
expect(payload).to.have.property('r', '22edbae2733bf6');
delete bidRequests[1].params.priceType;
});
});
Expand Down

0 comments on commit 30dddf8

Please sign in to comment.