Skip to content

Commit

Permalink
Admixer Bid Adapter: change admixerwl to rtbstack alias (prebid#11905)
Browse files Browse the repository at this point in the history
* Update README.md

update

* Add admixerwl alias for admixerBidAdapter.

* add rtbstack alias to admixerBidAdapter

* rtbstack tests

* RTB Stack Test Parameters

---------

Co-authored-by: AdmixerTech <35560933+AdmixerTech@users.noreply.github.com>
Co-authored-by: AdmixerTech <admin@admixer.net>
Co-authored-by: Yaroslav Masenko <intgr-user@admixer.ua>
Co-authored-by: Daria Boyko <dboyko@admixer.com>
  • Loading branch information
5 people authored and mefjush committed Jul 19, 2024
1 parent 46a5e50 commit e45aa2f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
16 changes: 10 additions & 6 deletions modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const ALIASES = [
{code: 'futureads', endpoint: 'https://ads.futureads.io/prebid.1.2.aspx'},
{code: 'smn', endpoint: 'https://ads.smn.rs/prebid.1.2.aspx'},
{code: 'admixeradx', endpoint: 'https://inv-nets.admixer.net/adxprebid.1.2.aspx'},
{code: 'admixerwl', endpoint: 'https://inv-nets-adxwl.admixer.com/adxwlprebid.aspx'},
'rtbstack'
];
export const spec = {
code: BIDDER_CODE,
Expand All @@ -23,8 +23,8 @@ export const spec = {
* Determines whether or not the given bid request is valid.
*/
isBidRequestValid: function (bid) {
return bid.bidder === 'admixerwl'
? !!bid.params.clientId && !!bid.params.endpointId
return bid.bidder === 'rtbstack'
? !!bid.params.endpointId
: !!bid.params.zone;
},
/**
Expand All @@ -51,8 +51,12 @@ export const spec = {
};
let endpointUrl;
if (bidderRequest) {
const {bidderCode} = bidderRequest;
endpointUrl = config.getConfig(`${bidderCode}.endpoint_url`);
// checks if there is specified any endpointUrl in bidder config
endpointUrl = config.getConfig('bidderURL');
if (!endpointUrl && bidderRequest.bidderCode === 'rtbstack') {
logError('The bidderUrl config is required for RTB Stack bids. Please set it with setBidderConfig() for "rtbstack".');
return;
}
// TODO: is 'page' the right value here?
if (bidderRequest.refererInfo?.page) {
payload.referrer = encodeURIComponent(bidderRequest.refererInfo.page);
Expand Down Expand Up @@ -82,7 +86,7 @@ export const spec = {
let urlForRequest = endpointUrl || getEndpointUrl(bidderRequest.bidderCode)
return {
method: 'POST',
url: bidderRequest.bidderCode === 'admixerwl' ? `${urlForRequest}?client=${payload.imps[0]?.params?.clientId}` : urlForRequest,
url: urlForRequest,
data: payload,
};
},
Expand Down
17 changes: 7 additions & 10 deletions modules/admixerBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,17 @@ Please use ```admixer``` as the bidder code.
];
```

### AdmixerWL Test Parameters
### RTB Stack Test Parameters
```
var adUnits = [
{
code: 'desktop-banner-ad-div',
sizes: [[300, 250]], // a display size
bids: [
{
bidder: "admixer",
bidder: "rtbstack",
params: {
endpointId: 41512,
clientId: 62
endpointId: 41512
}
}
]
Expand All @@ -71,10 +70,9 @@ Please use ```admixer``` as the bidder code.
sizes: [[300, 50]], // a mobile size
bids: [
{
bidder: "admixer",
bidder: "rtbstack",
params: {
endpointId: 41512,
clientId: 62
endpointId: 41512
}
}
]
Expand All @@ -84,10 +82,9 @@ Please use ```admixer``` as the bidder code.
mediaType: 'video',
bids: [
{
bidder: "admixer",
bidder: "rtbstack",
params: {
endpointId: 41512,
clientId: 62
endpointId: 41512
}
}
]
Expand Down
34 changes: 19 additions & 15 deletions test/spec/modules/admixerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {newBidder} from 'src/adapters/bidderFactory.js';
import {config} from '../../../src/config.js';

const BIDDER_CODE = 'admixer';
const WL_BIDDER_CODE = 'admixerwl'
const RTB_BIDDER_CODE = 'rtbstack'
const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.2.aspx';
const ENDPOINT_URL_CUSTOM = 'https://custom.admixer.net/prebid.aspx';
const ZONE_ID = '2eb6bd58-865c-47ce-af7f-a918108c3fd2';
Expand Down Expand Up @@ -37,10 +37,9 @@ describe('AdmixerAdapter', function () {
auctionId: '1d1a030790a475',
};

let wlBid = {
bidder: WL_BIDDER_CODE,
let rtbBid = {
bidder: RTB_BIDDER_CODE,
params: {
clientId: CLIENT_ID,
endpointId: ENDPOINT_ID,
},
adUnitCode: 'adunit-code',
Expand All @@ -56,8 +55,8 @@ describe('AdmixerAdapter', function () {
it('should return true when required params found', function () {
expect(spec.isBidRequestValid(bid)).to.equal(true);
});
it('should return true when params required by WL found', function () {
expect(spec.isBidRequestValid(wlBid)).to.equal(true);
it('should return true when params required by RTB found', function () {
expect(spec.isBidRequestValid(rtbBid)).to.equal(true);
});

it('should return false when required params are not passed', function () {
Expand All @@ -68,8 +67,8 @@ describe('AdmixerAdapter', function () {
};
expect(spec.isBidRequestValid(invalidBid)).to.equal(false);
});
it('should return false when params required by WL are not passed', function () {
let invalidBid = Object.assign({}, wlBid);
it('should return false when params required by RTB are not passed', function () {
let invalidBid = Object.assign({}, rtbBid);
delete invalidBid.params;
invalidBid.params = {
clientId: 0,
Expand Down Expand Up @@ -118,7 +117,7 @@ describe('AdmixerAdapter', function () {
it('sends bid request to CUSTOM_ENDPOINT via GET', function () {
config.setBidderConfig({
bidders: [BIDDER_CODE], // one or more bidders
config: { [BIDDER_CODE]: { endpoint_url: ENDPOINT_URL_CUSTOM } },
config: { bidderURL: ENDPOINT_URL_CUSTOM },
});
const request = config.runWithBidder(BIDDER_CODE, () =>
spec.buildRequests(validRequest, bidderRequest)
Expand All @@ -133,8 +132,7 @@ describe('AdmixerAdapter', function () {
validRequest: [
{
bidder: bidder,
params: bidder === 'admixerwl' ? {
clientId: CLIENT_ID,
params: bidder === 'rtbstack' ? {
endpointId: ENDPOINT_ID
} : {
zone: ZONE_ID,
Expand Down Expand Up @@ -193,10 +191,16 @@ describe('AdmixerAdapter', function () {
expect(request.url).to.equal('https://inv-nets.admixer.net/adxprebid.1.2.aspx');
expect(request.method).to.equal('POST');
});
it('build request for admixerwl', function () {
const requestParams = requestParamsFor('admixerwl');
const request = spec.buildRequests(requestParams.validRequest, requestParams.bidderRequest);
expect(request.url).to.equal(`https://inv-nets-adxwl.admixer.com/adxwlprebid.aspx?client=${CLIENT_ID}`);
it('build request for rtbstack', function () {
const requestParams = requestParamsFor('rtbstack');
config.setBidderConfig({
bidders: ['rtbstack'],
config: { bidderURL: ENDPOINT_URL_CUSTOM },
});
const request = config.runWithBidder(BIDDER_CODE, () =>
spec.buildRequests(requestParams.validRequest, requestParams.bidderRequest)
);
expect(request.url).to.equal(ENDPOINT_URL_CUSTOM);
expect(request.method).to.equal('POST');
});
});
Expand Down

0 comments on commit e45aa2f

Please sign in to comment.