Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luponmedia Bid Adapter (9.0 fixes) : remove discontinued fpd.context, remove unused onBid… #11619

Merged
merged 1 commit into from
May 30, 2024
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
18 changes: 1 addition & 17 deletions modules/luponmediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {BANNER} from '../src/mediaTypes.js';
import {ajax} from '../src/ajax.js';

const BIDDER_CODE = 'luponmedia';
const ENDPOINT_URL = 'https://rtb.adxpremium.services/openrtb2/auction';
Expand Down Expand Up @@ -220,19 +219,6 @@ export const spec = {

hasSynced = true;
return allUserSyncs;
},
onBidWon: bid => {
const bidString = JSON.stringify(bid);
spec.sendWinningsToServer(bidString);
},
sendWinningsToServer: data => {
let mutation = `mutation {createWin(input: {win: {eventData: "${window.btoa(data)}"}}) {win {createTime } } }`;
let dataToSend = JSON.stringify({ query: mutation });

ajax('https://analytics.adxpremium.services/graphql', null, dataToSend, {
contentType: 'application/json',
method: 'POST'
});
}
};

Expand Down Expand Up @@ -469,9 +455,7 @@ function newOrtbBidRequest(bidRequest, bidderRequest, currentImps) {
deepSetValue(data, 'ext.prebid.bidderconfig.0', bidderData);
}

// TODO: bidRequest.fpd is not the right place for pbadslot - who's filling that in, if anyone?
// is this meant to be bidRequest.ortb2Imp.ext.data.pbadslot?
const pbAdSlot = deepAccess(bidRequest, 'fpd.context.pbAdSlot');
const pbAdSlot = deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
if (typeof pbAdSlot === 'string' && pbAdSlot) {
deepSetValue(data.imp[0].ext, 'context.data.adslot', pbAdSlot);
}
Expand Down
45 changes: 0 additions & 45 deletions test/spec/modules/luponmediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,49 +385,4 @@ describe('luponmediaBidAdapter', function () {
expect(checkSchain).to.equal(false);
});
});

describe('onBidWon', function () {
const bidWonEvent = {
'bidderCode': 'luponmedia',
'width': 300,
'height': 250,
'statusMessage': 'Bid available',
'adId': '105bbf8c54453ff',
'requestId': '934b8752185955',
'mediaType': 'banner',
'source': 'client',
'cpm': 0.364,
'creativeId': '443801010',
'currency': 'USD',
'netRevenue': false,
'ttl': 300,
'referrer': '',
'ad': '',
'auctionId': '926a8ea3-3dd4-4bf2-95ab-c85c2ce7e99b',
'responseTimestamp': 1598527728026,
'requestTimestamp': 1598527727629,
'bidder': 'luponmedia',
'adUnitCode': 'div-gpt-ad-1533155193780-5',
'timeToRespond': 397,
'size': '300x250',
'status': 'rendered'
};

let ajaxStub;

beforeEach(() => {
ajaxStub = sinon.stub(spec, 'sendWinningsToServer')
})

afterEach(() => {
ajaxStub.restore()
})

it('calls luponmedia\'s callback endpoint', () => {
const result = spec.onBidWon(bidWonEvent);
expect(result).to.equal(undefined);
expect(ajaxStub.calledOnce).to.equal(true);
expect(ajaxStub.firstCall.args[0]).to.deep.equal(JSON.stringify(bidWonEvent));
});
});
});