Skip to content

Commit

Permalink
Connatix Bid Adapter : update PlayerId, CustomerId and Referrer (#10604)
Browse files Browse the repository at this point in the history
* Update PlayerId, CustomerId and Referrer from Connatix bid response

* updated unit tests

* new line
  • Loading branch information
rares-mihai-preda authored Oct 27, 2023
1 parent fabbbf1 commit 6a1fc2e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
7 changes: 3 additions & 4 deletions modules/connatixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ export const spec = {
interpretResponse: (serverResponse) => {
const responseBody = serverResponse.body;
const bids = responseBody.Bids;
const playerId = responseBody.PlayerId;
const customerId = responseBody.CustomerId;

if (!isArray(bids) || !playerId || !customerId) {
if (!isArray(bids)) {
return [];
}

const referrer = responseBody.Referrer;
return bids.map(bidResponse => ({
requestId: bidResponse.RequestId,
cpm: bidResponse.Cpm,
Expand All @@ -134,8 +133,8 @@ export const spec = {
width: bidResponse.Width,
height: bidResponse.Height,
creativeId: bidResponse.CreativeId,
referrer: bidResponse.Referrer,
ad: bidResponse.Ad,
referrer: referrer,
}));
},

Expand Down
19 changes: 18 additions & 1 deletion modules/connatixBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ Maintainer: prebid_integration@connatix.com

# Description
Connects to Connatix demand source to fetch bids.
Please use ```connatix``` as the bidder code.
Please use ```connatix``` as the bidder code.

# Configuration
Connatix requires that ```iframe``` is used for user syncing.

Example configuration:
```
pbjs.setConfig({
userSync: {
filterSettings: {
iframe: {
bidders: '*', // represents all bidders
filter: 'include'
}
}
}
});
```

# Test Parameters
```
Expand Down
20 changes: 2 additions & 18 deletions test/spec/modules/connatixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,12 @@ describe('connatixBidAdapter', function () {
describe('interpretResponse', function () {
const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
const Bid = {Cpm: 0.1, RequestId: '2f897340c4eaa3', Ttl: 86400, CustomerId, PlayerId};

let serverResponse;
this.beforeEach(function () {
serverResponse = {
body: {
CustomerId,
PlayerId,
Bids: [ Bid ]
},
headers: function() { }
Expand All @@ -162,18 +160,6 @@ describe('connatixBidAdapter', function () {
expect(response).to.be.an('array').that.is.empty;
});

it('Should return an empty array if CustomerId is null', function () {
serverResponse.body.CustomerId = null;
const response = spec.interpretResponse(serverResponse);
expect(response).to.be.an('array').that.is.empty;
});

it('Should return an empty array if PlayerId is null', function () {
serverResponse.body.PlayerId = null;
const response = spec.interpretResponse(serverResponse);
expect(response).to.be.an('array').that.is.empty;
});

it('Should return one bid response for one bid', function() {
const bidResponses = spec.interpretResponse(serverResponse);
expect(bidResponses.length).to.equal(1);
Expand Down Expand Up @@ -212,12 +198,10 @@ describe('connatixBidAdapter', function () {
const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
const UserSyncEndpoint = 'https://connatix.com/sync'
const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
const Bid = {Cpm: 0.1, RequestId: '2f897340c4eaa3', Ttl: 86400, CustomerId, PlayerId};

const serverResponse = {
body: {
CustomerId,
PlayerId,
UserSyncEndpoint,
Bids: [ Bid ]
},
Expand Down

0 comments on commit 6a1fc2e

Please sign in to comment.