Skip to content

Commit d8c2ffd

Browse files
mediasquare Bid Adapter: add DSA support (#11070)
* mediasquare Bid Adapter: add DSA support * mediasquare Bid Adapter: add DSA support
1 parent 35eb3d4 commit d8c2ffd

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

modules/mediasquareBidAdapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export const spec = {
9595
} else if (bidderRequest.hasOwnProperty('bids') && typeof bidderRequest.bids == 'object' && bidderRequest.bids.length > 0 && bidderRequest.bids[0].hasOwnProperty('userId')) {
9696
payload.userId = bidderRequest.bids[0].userId;
9797
}
98+
if (bidderRequest.ortb2?.regs?.ext?.dsa) { payload.dsa = bidderRequest.ortb2.regs.ext.dsa }
9899
};
99100
if (test) { payload.debug = true; }
100101
const payloadString = JSON.stringify(payload);
@@ -134,6 +135,7 @@ export const spec = {
134135
'advertiserDomains': value['adomain']
135136
}
136137
};
138+
if ('dsa' in value) { bidResponse.meta.dsa = value['dsa']; }
137139
let paramsToSearchFor = ['bidder', 'code', 'match', 'hasConsent', 'context', 'increment', 'ova'];
138140
paramsToSearchFor.forEach(param => {
139141
if (param in value) {

test/spec/modules/mediasquareBidAdapter_spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,34 @@ describe('MediaSquare bid adapter tests', function () {
102102
'context': 'instream',
103103
'increment': 1.0,
104104
'ova': 'cleared',
105+
'dsa': {
106+
'behalf': 'some-behalf',
107+
'paid': 'some-paid',
108+
'transparency': [{
109+
'domain': 'test.com',
110+
'dsaparams': [1, 2, 3]
111+
}],
112+
'adrender': 1
113+
}
105114
}],
106115
}};
107116

108117
const DEFAULT_OPTIONS = {
118+
ortb2: {
119+
regs: {
120+
ext: {
121+
dsa: {
122+
dsarequired: '1',
123+
pubrender: '2',
124+
datatopub: '3',
125+
transparency: [{
126+
domain: 'test.com',
127+
dsaparams: [1, 2, 3]
128+
}]
129+
}
130+
}
131+
}
132+
},
109133
gdprConsent: {
110134
gdprApplies: true,
111135
consentString: 'BOzZdA0OzZdA0AGABBENDJ-AAAAvh7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__79__3z3_9pxP78k89r7337Mw_v-_v-b7JCPN_Y3v-8Kg',
@@ -144,6 +168,7 @@ describe('MediaSquare bid adapter tests', function () {
144168
expect(requestContent.codes[0]).to.have.property('mediatypes').exist;
145169
expect(requestContent.codes[0]).to.have.property('floor').exist;
146170
expect(requestContent.codes[0].floor).to.deep.equal({});
171+
expect(requestContent).to.have.property('dsa');
147172
const requestfloor = spec.buildRequests(FLOORS_PARAMS, DEFAULT_OPTIONS);
148173
const responsefloor = JSON.parse(requestfloor.data);
149174
expect(responsefloor.codes[0]).to.have.property('floor').exist;
@@ -176,6 +201,7 @@ describe('MediaSquare bid adapter tests', function () {
176201
expect(bid.meta).to.exist;
177202
expect(bid.meta.advertiserDomains).to.exist;
178203
expect(bid.meta.advertiserDomains).to.have.lengthOf(1);
204+
expect(bid.meta.dsa).to.exist;
179205
});
180206
it('Verifies match', function () {
181207
const request = spec.buildRequests(DEFAULT_PARAMS, DEFAULT_OPTIONS);

0 commit comments

Comments
 (0)