Skip to content

Commit

Permalink
talkads Bid Adapter: update params access in case of different ad ser…
Browse files Browse the repository at this point in the history
…vers (#8390)

* Update talkadsBidAdapter.js

Update params access

* Update talkadsBidAdapter.js

update functions headers

* Update talkadsBidAdapter.js

Delete params attribute

* Update talkadsBidAdapter_spec.js

Delete params attribute
  • Loading branch information
natexo-technical-team authored May 9, 2022
1 parent 028843d commit 7f0a56b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 8 additions & 5 deletions modules/talkadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {ajax} from '../src/ajax.js';

const CURRENCY = 'EUR';
const BIDDER_CODE = 'talkads';
const GVLID = 1074;

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [ NATIVE, BANNER ],
params: null,

/**
* Determines whether or not the given bid request is valid.
Expand All @@ -31,7 +32,7 @@ export const spec = {
utils.logError('VALIDATION FAILED : the parameter "bidder_url" must be defined');
return false;
}
this.params = poBid.params;

return !!(poBid.nativeParams || poBid.sizes);
}, // isBidRequestValid

Expand All @@ -54,6 +55,7 @@ export const spec = {
}
return loOne;
});
let laParams = paValidBidRequests[0].params;
const loServerRequest = {
cur: CURRENCY,
timeout: poBidderRequest.timeout,
Expand All @@ -71,7 +73,7 @@ export const spec = {
loServerRequest.gdpr.consent = poBidderRequest.gdprConsent.consentString;
}
}
const lsUrl = this.params.bidder_url + '/' + this.params.tag_id;
const lsUrl = laParams.bidder_url + '/' + laParams.tag_id;
return {
method: 'POST',
url: lsUrl,
Expand All @@ -86,7 +88,7 @@ export const spec = {
* @param poPidRequest Request original server request
* @return An array of bids which were nested inside the server.
*/
interpretResponse: (poServerResponse, poPidRequest) => {
interpretResponse: function (poServerResponse, poPidRequest) {
utils.logInfo('interpretResponse : ', poServerResponse);
if (!poServerResponse.body) {
return [];
Expand Down Expand Up @@ -120,8 +122,9 @@ export const spec = {
*/
onBidWon: function (poBid) {
utils.logInfo('onBidWon : ', poBid);
let laParams = poBid.params[0];
if (poBid.pbid) {
ajax(this.params.bidder_url + 'won/' + poBid.pbid);
ajax(laParams.bidder_url + 'won/' + poBid.pbid);
}
}, // onBidWon
};
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/talkadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ describe('TalkAds adapter', function () {
ttl: 60,
creativeId: 'c123a456',
netRevenue: false,
params: [Object.assign({}, commonBidRequest.params)],
}
spec.onBidWon(loBid)
expect(server.requests.length).to.equals(0);
Expand All @@ -222,7 +223,8 @@ describe('TalkAds adapter', function () {
ttl: 60,
creativeId: 'c123a456',
netRevenue: false,
pbid: '6147833a65749742875ace47'
pbid: '6147833a65749742875ace47',
params: [Object.assign({}, commonBidRequest.params)],
}
spec.onBidWon(loBid)
expect(server.requests[0].url).to.equals('https://test.natexo-programmatic.com/tad/tag/prebidwon/6147833a65749742875ace47');
Expand Down

0 comments on commit 7f0a56b

Please sign in to comment.