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

Missena Bid Adapter : send coppa and autoplay #12352

Merged
merged 2 commits into from
Oct 31, 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
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