Skip to content

Commit 8f8f6f8

Browse files
change payload (#5105)
1 parent b8d5e05 commit 8f8f6f8

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

modules/proxistoreBidAdapter.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,23 @@ const { registerBidder } = require('../src/adapters/bidderFactory.js');
22
const BIDDER_CODE = 'proxistore';
33
const PROXISTORE_VENDOR_ID = 418;
44

5-
function _mapSizes(sizes) {
6-
const flatSize = sizes.reduce((acc, val) => acc.concat(val), []); ;
7-
return flatSize.map(array1d => { return { width: array1d[0], height: array1d[1] } });
8-
}
9-
105
function _createServerRequest(bidRequests, bidderRequest) {
6+
const sizeIds = [];
7+
bidRequests.forEach(bid => {
8+
const sizeId = {id: bid.bidId, sizes: bid.sizes.map(size => { return { width: size[0], height: size[1] } })};
9+
sizeIds.push(sizeId);
10+
});
1111
const payload = {
1212
auctionId: bidRequests[0].auctionId,
13-
transactionId: bidRequests[0].transactionId,
14-
sizes: _mapSizes(bidRequests.map(x => x.sizes)),
13+
transactionId: bidRequests[0].auctionId,
14+
bids: sizeIds,
1515
website: bidRequests[0].params.website,
1616
language: bidRequests[0].params.language,
1717
gdpr: {
1818
applies: false
1919
}
2020
};
2121

22-
const bidIds = bidRequests.map(req => req.bidId);
23-
bidIds.length === 1 ? payload.bidId = bidIds[0] : payload.bidIds = bidIds;
24-
2522
const options = {
2623
contentType: 'application/json',
2724
withCredentials: true
@@ -42,7 +39,7 @@ function _createServerRequest(bidRequests, bidderRequest) {
4239

4340
return {
4441
method: 'POST',
45-
url: bidRequests[0].params.url || 'https://abs.proxistore.com/' + payload.language + '/v3/rtb/prebid',
42+
url: bidRequests[0].params.url || 'https://abs.proxistore.com/' + payload.language + '/v3/rtb/prebid/multi',
4643
data: JSON.stringify(payload),
4744
options: options
4845
};

test/spec/modules/proxistoreBidAdapter_spec.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('ProxistoreBidAdapter', function () {
3434
});
3535

3636
describe('buildRequests', function () {
37-
const url = 'https://abs.proxistore.com/fr/v3/rtb/prebid';
37+
const url = 'https://abs.proxistore.com/fr/v3/rtb/prebid/multi';
3838
const request = spec.buildRequests([bid], bidderRequest);
3939
it('should return a valid object', function () {
4040
expect(request).to.be.an('object');
@@ -55,10 +55,14 @@ describe('ProxistoreBidAdapter', function () {
5555
expect(data.gdpr.applies).to.be.true;
5656
expect(data.gdpr.consentGiven).to.be.true;
5757
});
58-
it('should have a property bidId if there is only one bid', function () {
58+
it('should have a property a length of bids equal to one if there is only one bid', function () {
5959
const data = JSON.parse(request.data);
60-
expect(data.hasOwnProperty('bidId')).to.be.true;
61-
})
60+
expect(data.hasOwnProperty('bids')).to.be.true;
61+
expect(data.bids).to.be.an('array');
62+
expect(data.bids.length).equal(1);
63+
expect(data.bids[0].hasOwnProperty('id')).to.be.true;
64+
expect(data.bids[0].sizes).to.be.an('array');
65+
});
6266
});
6367

6468
describe('interpretResponse', function () {

0 commit comments

Comments
 (0)