Skip to content
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
12 changes: 8 additions & 4 deletions modules/aolBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const MP_SERVER_MAP = {
as: 'adserver-as.adtech.advertising.com'
};
const NEXAGE_SERVER = 'hb.nexage.com';
const BID_RESPONSE_TTL = 300;
const ONE_DISPLAY_TTL = 60;
const ONE_MOBILE_TTL = 3600;

$$PREBID_GLOBAL$$.aolGlobals = {
pixelsDropped: false
Expand Down Expand Up @@ -224,7 +225,7 @@ function _parseBidResponse(response, bidRequest) {
currency: response.cur,
dealId: bidData.dealid,
netRevenue: true,
ttl: BID_RESPONSE_TTL
ttl: bidRequest.ttl
};
}

Expand Down Expand Up @@ -274,21 +275,24 @@ function formatBidRequest(endpointCode, bid) {
case AOL_ENDPOINTS.DISPLAY.GET:
bidRequest = {
url: _buildMarketplaceUrl(bid),
method: 'GET'
method: 'GET',
ttl: ONE_DISPLAY_TTL
};
break;

case AOL_ENDPOINTS.MOBILE.GET:
bidRequest = {
url: _buildOneMobileGetUrl(bid),
method: 'GET'
method: 'GET',
ttl: ONE_MOBILE_TTL
};
break;

case AOL_ENDPOINTS.MOBILE.POST:
bidRequest = {
url: _buildOneMobileBaseUrl(bid),
method: 'POST',
ttl: ONE_MOBILE_TTL,
data: bid.params,
options: {
contentType: 'application/json',
Expand Down
19 changes: 15 additions & 4 deletions test/spec/modules/aolBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ let getPixels = () => {
};

describe('AolAdapter', () => {
const MARKETPLACE_URL = 'adserver-us.adtech.advertising.com/pubapi/3.0/';
const NEXAGE_URL = 'hb.nexage.com/bidRequest?';
const MARKETPLACE_URL = '//adserver-us.adtech.advertising.com/pubapi/3.0/';
const NEXAGE_URL = '//hb.nexage.com/bidRequest?';
const ONE_DISPLAY_TTL = 60;
const ONE_MOBILE_TTL = 3600;

function createCustomBidRequest({bids, params} = {}) {
var bidderRequest = getDefaultBidRequest();
Expand All @@ -98,7 +100,8 @@ describe('AolAdapter', () => {
bidderSettingsBackup = $$PREBID_GLOBAL$$.bidderSettings;
bidRequest = {
bidderCode: 'test-bidder-code',
bidId: 'bid-id'
bidId: 'bid-id',
ttl: 1234
};
bidResponse = {
body: getDefaultBidResponse()
Expand All @@ -125,7 +128,7 @@ describe('AolAdapter', () => {
currency: 'USD',
dealId: 'deal-id',
netRevenue: true,
ttl: 300
ttl: bidRequest.ttl
});
});

Expand Down Expand Up @@ -355,6 +358,13 @@ describe('AolAdapter', () => {
let [request] = spec.buildRequests(bidRequest.bids);
expect(request.url).to.contain('kvage=25;kvheight=3.42;kvtest=key');
});

it('should return request object for One Display when configuration is present', () => {
let bidRequest = getDefaultBidRequest();
let [request] = spec.buildRequests(bidRequest.bids);
expect(request.method).to.equal('GET');
expect(request.ttl).to.equal(ONE_DISPLAY_TTL);
});
});

describe('One Mobile', () => {
Expand Down Expand Up @@ -454,6 +464,7 @@ describe('AolAdapter', () => {
let [request] = spec.buildRequests(bidRequest.bids);
expect(request.url).to.contain(NEXAGE_URL);
expect(request.method).to.equal('POST');
expect(request.ttl).to.equal(ONE_MOBILE_TTL);
expect(request.data).to.deep.equal(bidConfig);
expect(request.options).to.deep.equal({
contentType: 'application/json',
Expand Down