Skip to content

Commit

Permalink
Missena Bid Adapter : send coppa and autoplay
Browse files Browse the repository at this point in the history
  • Loading branch information
pdamoc committed Oct 22, 2024
1 parent 272cabf commit 7fee47d
Show file tree
Hide file tree
Showing 2 changed files with 20 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 = config.getConfig('coppa') === true ? 1 : 0;
payload.autoplay = isAutoplayEnabled();

return {
method: 'POST',
Expand Down
16 changes: 16 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,7 @@ describe('Missena Adapter', function () {
storageAllowed: true,
},
};
sinon.stub(config, 'getConfig').withArgs('coppa').returns(true);

const bidId = 'abc';
const bid = {
Expand Down Expand Up @@ -102,11 +105,24 @@ describe('Missena Adapter', function () {
'getDataFromLocalStorage',
);

const isAutoplayEnabledStub = sinon.stub(autoplay, 'isAutoplayEnabled');
isAutoplayEnabledStub.returns(false);

const requests = spec.buildRequests(bids, bidderRequest);
const request = requests[0];
const payload = JSON.parse(request.data);
const payloadNoFloor = JSON.parse(requests[1].data);

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

isAutoplayEnabledStub.restore();

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

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

0 comments on commit 7fee47d

Please sign in to comment.