Skip to content

Commit

Permalink
Missena Bid Adapter : send coppa and autoplay (prebid#12352)
Browse files Browse the repository at this point in the history
* Missena Bid Adapter : send coppa and autoplay

* switch to bidderRequest.ortb2.regs.coppa
  • Loading branch information
pdamoc authored Oct 31, 2024
1 parent 91b1407 commit 45e9277
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/missenaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { config } from '../src/config.js';
import { BANNER } from '../src/mediaTypes.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';
import { isAutoplayEnabled } from '../libraries/autoplayDetection/autoplay.js';

/**
* @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
Expand Down Expand Up @@ -91,8 +92,10 @@ function toPayload(bidRequest, bidderRequest) {
const bidFloor = getFloor(bidRequest);
payload.floor = bidFloor?.floor;
payload.floor_currency = bidFloor?.currency;
payload.currency = config.getConfig('currency.adServerCurrency') || 'EUR';
payload.currency = config.getConfig('currency.adServerCurrency');
payload.schain = bidRequest.schain;
payload.coppa = bidderRequest?.ortb2?.regs?.coppa ? 1 : 0;
payload.autoplay = isAutoplayEnabled() === true ? 1 : 0;

return {
method: 'POST',
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/missenaBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { expect } from 'chai';
import { spec, storage } from 'modules/missenaBidAdapter.js';
import { BANNER } from '../../../src/mediaTypes.js';
import { config } from 'src/config.js';
import * as autoplay from 'libraries/autoplayDetection/autoplay.js';

const REFERRER = 'https://referer';
const REFERRER2 = 'https://referer2';
Expand All @@ -12,6 +14,9 @@ describe('Missena Adapter', function () {
storageAllowed: true,
},
};
let sandbox = sinon.sandbox.create();
sandbox.stub(config, 'getConfig').withArgs('coppa').returns(true);
sandbox.stub(autoplay, 'isAutoplayEnabled').returns(false);

const bidId = 'abc';
const bid = {
Expand Down Expand Up @@ -69,6 +74,7 @@ describe('Missena Adapter', function () {
topmostLocation: REFERRER,
canonicalUrl: 'https://canonical',
},
ortb2: { regs: { coppa: 1 } },
};

const bids = [bid, bidWithoutFloor];
Expand Down Expand Up @@ -107,6 +113,15 @@ describe('Missena Adapter', function () {
const payload = JSON.parse(request.data);
const payloadNoFloor = JSON.parse(requests[1].data);

it('should send disabled autoplay', function () {
expect(payload.autoplay).to.equal(0);
});

it('should contain coppa', function () {
expect(payload.coppa).to.equal(1);
});
sandbox.restore();

it('should contain uspConsent', function () {
expect(payload.us_privacy).to.equal('IDO');
});
Expand Down

0 comments on commit 45e9277

Please sign in to comment.