Skip to content

Commit

Permalink
Seedtag Bid Adapter : allows sending bcat and badv ortb2 params in re…
Browse files Browse the repository at this point in the history
…quest payload (prebid#11490)

* sends bcat and badv ortb2 params in request payload

* adds tests for bcat and badv
  • Loading branch information
sangarbe authored and mefjush committed May 21, 2024
1 parent 8025124 commit 89456e4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/seedtagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@ export const spec = {
payload.user.eids = validBidRequests[0].userIdAsEids
}

if (bidderRequest.ortb2?.bcat) {
payload.bcat = bidderRequest.ortb2?.bcat
}

if (bidderRequest.ortb2?.badv) {
payload.badv = bidderRequest.ortb2?.badv
}

const payloadString = JSON.stringify(payload);

return {
Expand Down
36 changes: 36 additions & 0 deletions test/spec/modules/seedtagBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,42 @@ describe('Seedtag Adapter', function () {
expect(data.user.eids).to.deep.equal(userIdAsEids);
})
});

describe('Blocking params', function () {
it('should add bcat param to payload when bidderRequest has ortb2 bcat info', function () {
const blockedCategories = ['IAB1', 'IAB2']
var ortb2 = {
bcat: blockedCategories
}
bidderRequest['ortb2'] = ortb2

const request = spec.buildRequests(validBidRequests, bidderRequest);
const data = JSON.parse(request.data);
expect(data.bcat).to.deep.equal(blockedCategories);
});

it('should add badv param to payload when bidderRequest has ortb2 badv info', function () {
const blockedAdvertisers = ['blocked.com']
var ortb2 = {
badv: blockedAdvertisers
}
bidderRequest['ortb2'] = ortb2

const request = spec.buildRequests(validBidRequests, bidderRequest);
const data = JSON.parse(request.data);
expect(data.badv).to.deep.equal(blockedAdvertisers);
});

it('should not add bcat and badv params to payload when bidderRequest does not have ortb2 badv and bcat info', function () {
var ortb2 = {}
bidderRequest['ortb2'] = ortb2

const request = spec.buildRequests(validBidRequests, bidderRequest);
const data = JSON.parse(request.data);
expect(data.bcat).to.be.undefined;
expect(data.badv).to.be.undefined;
});
});
})
describe('interpret response method', function () {
it('should return a void array, when the server response are not correct.', function () {
Expand Down

0 comments on commit 89456e4

Please sign in to comment.