Skip to content

Commit

Permalink
Yieldmo Bid Adapter: adding Prebid 9 compatibility (#11507)
Browse files Browse the repository at this point in the history
* Removing placement validation

* Adding render back

* add validation

* remove validation for plcmt

* Update unit tests
  • Loading branch information
desidiver committed May 20, 2024
1 parent ecdde0f commit 1faf5e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
18 changes: 4 additions & 14 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function hasVideoMediaType(bidRequest) {
* @param request bid request
*/
function addPlacement(request) {
const gpid = deepAccess(request, 'ortb2Imp.ext.data.pbadslot');
const gpid = deepAccess(request, 'ortb2Imp.ext.gpid') || deepAccess(request, 'ortb2Imp.ext.data.pbadslot');
const placementInfo = {
placement_id: request.adUnitCode,
callback_id: request.bidId,
Expand Down Expand Up @@ -337,8 +337,7 @@ function createNewVideoBid(response, bidRequest) {
mediaType: VIDEO,
},
};

if (imp.video.placement && imp.video.placement !== 1) {
if (imp.video.plcmt && imp.video.plcmt !== 1) {
const renderer = Renderer.install({
url: OUTSTREAM_VIDEO_PLAYER_URL,
config: {
Expand All @@ -349,7 +348,7 @@ function createNewVideoBid(response, bidRequest) {
allowVpaid: true,
autoPlay: true,
preload: true,
mute: true
mute: true,
},
id: imp.tagid,
loaded: false,
Expand Down Expand Up @@ -471,7 +470,7 @@ function getTopics(bidderRequest) {
* @return Object OpenRTB's 'imp' (impression) object
*/
function openRtbImpression(bidRequest) {
const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.gpid') || deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
const size = extractPlayerSize(bidRequest);
const imp = {
id: bidRequest.bidId,
Expand Down Expand Up @@ -653,15 +652,6 @@ function validateVideoParams(bid) {
validate('video.mimes', val => isDefined(val), paramRequired);
validate('video.mimes', val => isArray(val) && val.every(v => isStr(v)), paramInvalid,
'array of strings, ex: ["video/mp4"]');

const placement = validate('video.placement', val => isDefined(val), paramRequired);
validate('video.placement', val => val >= 1 && val <= 5, paramInvalid);
if (placement === 1) {
validate('video.startdelay', val => isDefined(val),
(field, v) => paramRequired(field, v, 'placement == 1'));
validate('video.startdelay', val => isNumber(val), paramInvalid, 'number, ex: 5');
}

validate('video.protocols', val => isDefined(val), paramRequired);

validate('video.api', val => isDefined(val), paramRequired);
Expand Down
3 changes: 0 additions & 3 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ describe('YieldmoAdapter', function () {

it('should return false when required bid.params.video.* is not found', function () {
const getBidAndExclude = paramToRemove => getVideoBidWithoutParam('params.video', paramToRemove);

expect(spec.isBidRequestValid(getBidAndExclude('placement'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('maxduration'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('startdelay'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('protocols'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('api'))).to.be.false;
});
Expand Down

0 comments on commit 1faf5e9

Please sign in to comment.