From d6a00e6d9ef4a25af3b9bdfc4e7c1605ca53d726 Mon Sep 17 00:00:00 2001 From: Li Xinyang Date: Wed, 25 Oct 2017 12:31:53 +0800 Subject: [PATCH] Add required params from the server response --- modules/quantcastBidAdapter.js | 11 +++++++++-- test/spec/modules/quantcastBidAdapter_spec.js | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/modules/quantcastBidAdapter.js b/modules/quantcastBidAdapter.js index 0d0d2040476..f10fd48502f 100644 --- a/modules/quantcastBidAdapter.js +++ b/modules/quantcastBidAdapter.js @@ -3,9 +3,12 @@ import { registerBidder } from 'src/adapters/bidderFactory'; const BIDDER_CODE = 'quantcast'; const DEFAULT_BID_FLOOR = 0.0000000001; + export const QUANTCAST_CALLBACK_URL = 'global.qc.rtb.quantserve.com'; export const QUANTCAST_CALLBACK_URL_TEST = 's2s-canary.quantserve.com'; +export const QUANTCAST_NET_REVENUE = true; export const QUANTCAST_TEST_PUBLISHER = 'test-publisher'; +export const QUANTCAST_TTL = 4; /** * The documentation for Prebid.js Adapter 1.0 can be found at link below, @@ -140,14 +143,18 @@ export const spec = { } const bidResponsesList = response.bids.map(bid => { - const { ad, cpm, width, height } = bid; + const { ad, cpm, width, height, creativeId, currency } = bid; return { requestId: response.requestId, cpm, width, height, - ad + ad, + ttl: QUANTCAST_TTL, + creativeId, + netRevenue: QUANTCAST_NET_REVENUE, + currency }; }); diff --git a/test/spec/modules/quantcastBidAdapter_spec.js b/test/spec/modules/quantcastBidAdapter_spec.js index c38a0b77334..14981f198b6 100644 --- a/test/spec/modules/quantcastBidAdapter_spec.js +++ b/test/spec/modules/quantcastBidAdapter_spec.js @@ -1,9 +1,11 @@ import * as utils from 'src/utils'; import { expect } from 'chai'; import { - spec as qcSpec, + QUANTCAST_CALLBACK_URL_TEST, QUANTCAST_CALLBACK_URL, - QUANTCAST_CALLBACK_URL_TEST + QUANTCAST_NET_REVENUE, + QUANTCAST_TTL, + spec as qcSpec } from '../../../modules/quantcastBidAdapter'; import { newBidder } from '../../../src/adapters/bidderFactory'; @@ -144,8 +146,10 @@ describe('Quantcast adapter', () => { statusCode: 1, placementCode: 'imp1', // Changing this to placementCode to be reflective cpm: 4.5, + currency: 'USD', ad: '
Quantcast
', + creativeId: 1001, width: 300, height: 250 } @@ -177,12 +181,16 @@ describe('Quantcast adapter', () => { it('should get correct bid response', () => { const expectedResponse = { - ad: - '
Quantcast
', + requestId: 'erlangcluster@qa-rtb002.us-ec.adtech.com-11417780270886458', cpm: 4.5, width: 300, height: 250, - requestId: 'erlangcluster@qa-rtb002.us-ec.adtech.com-11417780270886458' + ad: + '
Quantcast
', + ttl: QUANTCAST_TTL, + creativeId: 1001, + netRevenue: QUANTCAST_NET_REVENUE, + currency: 'USD' }; const interpretedResponse = qcSpec.interpretResponse(response);