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

StroeerCore Bid Adapter: add special format parameters to bid request #12276

Merged
merged 1 commit into from
Sep 27, 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
1 change: 1 addition & 0 deletions modules/stroeerCoreBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const mapToPayloadBaseBid = (bidRequest) => ({
bid: bidRequest.bidId,
sid: bidRequest.params.sid,
viz: elementInView(bidRequest.adUnitCode),
sfp: bidRequest.params.sfp,
});

const mapToPayloadBannerBid = (bidRequest) => {
Expand Down
47 changes: 42 additions & 5 deletions test/spec/modules/stroeerCoreBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ describe('stroeerCore bid adapter', function () {
'siz': [[300, 600], [160, 60]],
'fp': undefined
},
'sfp': undefined,
},
{
'sid': 'ABC=',
Expand All @@ -541,7 +542,8 @@ describe('stroeerCore bid adapter', function () {
'siz': [[100, 200], [300, 500]],
'fp': undefined
},
'viz': undefined
'viz': undefined,
'sfp': undefined,
}
];

Expand All @@ -555,7 +557,8 @@ describe('stroeerCore bid adapter', function () {
'siz': [640, 480],
'mim': ['video/mp4', 'video/quicktime'],
'fp': undefined
}
},
'sfp': undefined,
}
];

Expand Down Expand Up @@ -597,7 +600,8 @@ describe('stroeerCore bid adapter', function () {
'ban': {
'siz': [[100, 200], [300, 500]],
'fp': undefined
}
},
'sfp': undefined,
}
];

Expand All @@ -611,14 +615,14 @@ describe('stroeerCore bid adapter', function () {
'siz': [640, 480],
'mim': ['video/mp4', 'video/quicktime'],
'fp': undefined
}
},
'sfp': undefined,
}
];

assert.deepEqual(serverRequestInfo.data.bids, [...expectedBannerBids, ...expectedVideoBids]);
});
});

describe('optional fields', () => {
it('should skip viz field when unable to determine visibility of placement', () => {
placementElements.length = 0;
Expand Down Expand Up @@ -898,6 +902,39 @@ describe('stroeerCore bid adapter', function () {

assert.deepEqual(sentOrtb2, ortb2);
});

it('should add the special format parameters', () => {
const bidReq = buildBidderRequest();

const sfp0 = {
'field1': {
'abc': '123',
}
};

const sfp1 = {
'field3': 'xyz'
};

bidReq.bids[0].params.sfp = utils.deepClone(sfp0);
bidReq.bids[1].params.sfp = utils.deepClone(sfp1);

const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);

assert.deepEqual(serverRequestInfo.data.bids[0].sfp, sfp0);
assert.deepEqual(serverRequestInfo.data.bids[1].sfp, sfp1);
});

it('should add the special format parameters even when it is an empty object', () => {
const bidReq = buildBidderRequest();

bidReq.bids[0].params.sfp = {};

const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);

assert.deepEqual(serverRequestInfo.data.bids[0].sfp, {});
assert.isUndefined(serverRequestInfo.data.bids[1].sfp);
});
});
});
});
Expand Down