Skip to content

Commit

Permalink
Bugfix add bid parameters if not present (#3808)
Browse files Browse the repository at this point in the history
* initial orbidder version in personal github repo

* use adUnits from orbidder_example.html

* replace obsolete functions

* forgot to commit the test

* check if bidderRequest object is available

* try to fix weird safari/ie issue

* ebayK: add more params

* update orbidderBidAdapter.md

* use spec.<function> instead of this.<function> for consistency reasons

* add bidfloor parameter to params object

* fix gdpr object handling

* default to consentRequired: false when not explicitly given

* wip - use onSetTargeting callback

* add tests for onSetTargeting callback

* fix params and respective tests
  • Loading branch information
arneschulz1984 authored and jsnellbaker committed Jun 4, 2019
1 parent 2f208f8 commit 2a10388
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 2 additions & 3 deletions modules/orbidderBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ export const spec = {
const getRefererInfo = detectReferer(window);

bid.pageUrl = getRefererInfo().referer;
if (spec.bidParams[bid.adId]) {
bid.params = spec.bidParams[bid.adId];
if (spec.bidParams[bid.requestId] && (typeof bid.params === 'undefined')) {
bid.params = [spec.bidParams[bid.requestId]];
}

spec.ajaxCall(`${spec.orbidderHost}${route}`, JSON.stringify(bid));
},

Expand Down
14 changes: 11 additions & 3 deletions test/spec/modules/orbidderBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {expect} from 'chai';
import {spec} from 'modules/orbidderBidAdapter';
import {newBidder} from 'src/adapters/bidderFactory';
import openxAdapter from '../../../modules/openxAnalyticsAdapter';
import {detectReferer} from 'src/refererDetection';

describe('orbidderBidAdapter', () => {
const adapter = newBidder(spec);
Expand Down Expand Up @@ -153,9 +154,16 @@ describe('orbidderBidAdapter', () => {
adId: 'testId',
test: 1,
pageUrl: 'www.someurl.de',
referrer: 'www.somereferrer.de'
referrer: 'www.somereferrer.de',
requestId: '123req456'
};

spec.bidParams['123req456'] = {'accountId': '123acc456'};

let bidObjClone = deepClone(bidObj);
bidObjClone.pageUrl = detectReferer(window)().referer;
bidObjClone.params = [{'accountId': '123acc456'}];

beforeEach(() => {
ajaxStub = sinon.stub(spec, 'ajaxCall');
});
Expand All @@ -169,13 +177,13 @@ describe('orbidderBidAdapter', () => {
expect(ajaxStub.calledOnce).to.equal(true);
expect(ajaxStub.firstCall.args[0].indexOf('https://')).to.equal(0);
expect(ajaxStub.firstCall.args[0]).to.equal(`${spec.orbidderHost}/win`);
expect(ajaxStub.firstCall.args[1]).to.equal(JSON.stringify(bidObj));
expect(ajaxStub.firstCall.args[1]).to.equal(JSON.stringify(bidObjClone));

spec.onSetTargeting(bidObj);
expect(ajaxStub.calledTwice).to.equal(true);
expect(ajaxStub.secondCall.args[0].indexOf('https://')).to.equal(0);
expect(ajaxStub.secondCall.args[0]).to.equal(`${spec.orbidderHost}/targeting`);
expect(ajaxStub.secondCall.args[1]).to.equal(JSON.stringify(bidObj));
expect(ajaxStub.secondCall.args[1]).to.equal(JSON.stringify(bidObjClone));
});
});

Expand Down

0 comments on commit 2a10388

Please sign in to comment.