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

StroeerCore Bid Adapter: add DSA support #11083

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 9 additions & 2 deletions modules/stroeerCoreBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { buildUrl, deepAccess, generateUUID, getWindowSelf, getWindowTop, isEmpty, isStr, logWarn } from '../src/utils.js';
import { buildUrl, deepAccess, deepSetValue, generateUUID, getWindowSelf, getWindowTop, isEmpty, isStr, logWarn } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {find} from '../src/polyfill.js';
Expand Down Expand Up @@ -76,6 +76,12 @@ export const spec = {
};
}

const DSA_KEY = 'ortb2.regs.ext.dsa';
const dsa = deepAccess(bidderRequest, DSA_KEY);
if (dsa) {
deepSetValue(basePayload, DSA_KEY, dsa);
}

const bannerBids = validBidRequests
.filter(hasBanner)
.map(mapToPayloadBannerBid);
Expand Down Expand Up @@ -108,7 +114,8 @@ export const spec = {
netRevenue: true,
creativeId: '',
meta: {
advertiserDomains: bidResponse.adomain
advertiserDomains: bidResponse.adomain,
dsa: bidResponse.dsa
},
mediaType,
};
Expand Down
60 changes: 56 additions & 4 deletions test/spec/modules/stroeerCoreBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,39 @@ describe('stroeerCore bid adapter', function () {
assert.nestedPropertyVal(bid, 'ban.fp.cur', 'EUR');
assert.deepNestedPropertyVal(bid, 'ban.fp.siz', [{w: 160, h: 60, p: 2.7}]);
});

it('should add the DSA signals', () => {
const bidReq = buildBidderRequest();
const dsa = {
dsarequired: 3,
pubrender: 0,
datatopub: 2,
transparency: [
{
domain: 'testplatform.com',
dsaparams: [1],
},
{
domain: 'testdomain.com',
dsaparams: [1, 2]
}
]
}
const ortb2 = {
regs: {
ext: {
dsa
}
}
}

bidReq.ortb2 = utils.deepClone(ortb2);

const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);
const sentOrtb2 = serverRequestInfo.data.ortb2;

assert.deepEqual(sentOrtb2, ortb2);
});
});
});
});
Expand Down Expand Up @@ -882,13 +915,32 @@ describe('stroeerCore bid adapter', function () {
assertStandardFieldsOnVideoBid(videoBidResponse, 'bid1', '<vast>video</vast>', 800, 250, 4);
})

it('should add data to meta object', () => {
it('should add advertiser domains to meta object', () => {
const response = buildBidderResponse();
response.bids[0] = Object.assign(response.bids[0], {adomain: ['website.org', 'domain.com']});
const result = spec.interpretResponse({body: response});
assert.deepPropertyVal(result[0], 'meta', {advertiserDomains: ['website.org', 'domain.com']});
// nothing provided for the second bid
assert.deepPropertyVal(result[1], 'meta', {advertiserDomains: undefined});
assert.deepPropertyVal(result[0].meta, 'advertiserDomains', ['website.org', 'domain.com']);
assert.propertyVal(result[1].meta, 'advertiserDomains', undefined);
});

it('should add dsa info to meta object', () => {
const dsaResponse = {
behalf: 'AdvertiserA',
paid: 'AdvertiserB',
transparency: [{
domain: 'dspexample.com',
dsaparams: [1, 2],
}],
adrender: 1
};

const response = buildBidderResponse();
response.bids[0] = Object.assign(response.bids[0], {dsa: utils.deepClone(dsaResponse)});

const result = spec.interpretResponse({body: response});

assert.deepPropertyVal(result[0].meta, 'dsa', dsaResponse);
assert.propertyVal(result[1].meta, 'dsa', undefined);
});
});

Expand Down