-
Notifications
You must be signed in to change notification settings - Fork 224
OMS: add video support #3779
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
OMS: add video support #3779
Changes from 1 commit
d87670e
6459db5
f32d656
ed5230c
057d343
2d95af3
cef4cb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,11 +45,8 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request | |
| if (!request.getImp().isEmpty()) { | ||
| try { | ||
| final ExtImpOms impExt = parseImpExt(request.getImp().getFirst()); | ||
| final String publisherId = impExt.getPid() == null | ||
| && impExt.getPublisherId() != null | ||
| && impExt.getPublisherId() > 0 | ||
| ? String.valueOf(impExt.getPublisherId()) | ||
| : impExt.getPid(); | ||
| final String publisherId = impExt.getPublisherId() != null && impExt.getPublisherId() > 0 | ||
| ? String.valueOf(impExt.getPublisherId()) : null; | ||
|
||
| final String url = "%s?publisherId=%s".formatted(endpointUrl, publisherId); | ||
| return Result.withValue(BidderUtil.defaultRequest(request, url, mapper)); | ||
| } catch (PreBidException e) { | ||
|
|
@@ -91,37 +88,32 @@ private static List<BidderBid> bidsFromResponse(BidResponse bidResponse) { | |
| .map(SeatBid::getBid) | ||
| .filter(Objects::nonNull) | ||
| .flatMap(Collection::stream) | ||
| .map(bid -> BidderBid.builder() | ||
| .bid(bid) | ||
| .type(getBidType(bid)) | ||
| .bidCurrency(bidResponse.getCur()) | ||
| .videoInfo(videoInfo(bid)) | ||
| .build()) | ||
| .map(bid -> { | ||
| final BidType bidType = getBidType(bid); | ||
| return BidderBid.builder() | ||
| .bid(bid) | ||
| .type(bidType) | ||
| .bidCurrency(bidResponse.getCur()) | ||
| .videoInfo(videoInfo(bidType, bid)) | ||
| .build(); | ||
CTMBNara marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }) | ||
| .toList(); | ||
| } | ||
|
|
||
| private static BidType getBidType(Bid bid) { | ||
| final Integer markupType = bid.getMtype(); | ||
| return switch (markupType) { | ||
| case 1 -> BidType.banner; | ||
| case 2 -> BidType.video; | ||
| case null, default -> BidType.banner; | ||
| }; | ||
| return Objects.equals(bid.getMtype(), 2) ? BidType.video : BidType.banner; | ||
| } | ||
|
|
||
| private static ExtBidPrebidVideo videoInfo(Bid bid) { | ||
| if (!Integer.valueOf(2).equals(bid.getMtype())) { | ||
| private static ExtBidPrebidVideo videoInfo(BidType bidType, Bid bid) { | ||
| if (bidType != BidType.video) { | ||
| return null; | ||
| } | ||
| final List<String> cat = bid.getCat(); | ||
| final Integer duration = bid.getDur(); | ||
|
|
||
| final boolean catNotEmpty = CollectionUtils.isNotEmpty(cat); | ||
| final boolean durationValid = duration != null && duration > 0; | ||
| return catNotEmpty || durationValid | ||
| ? ExtBidPrebidVideo.of( | ||
| durationValid ? duration : null, | ||
| catNotEmpty ? cat.getFirst() : null) | ||
| : null; | ||
| return ExtBidPrebidVideo.of( | ||
| duration != null ? duration : 0, | ||
|
||
| CollectionUtils.isNotEmpty(cat) ? cat.getFirst() : "" | ||
|
||
| ); | ||
CTMBNara marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| @Value(staticConstructor = "of") | ||
| public class ExtImpOms { | ||
|
|
||
| String pid; | ||
|
||
| @JsonProperty("publisherId") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add an empty line |
||
| Integer publisherId; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add JsonProperty also I would change the integration test payload to cover
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have cheanged pid to publisherId but IMO its indifferent
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant, it makes sense to add a publisherId to the test instead of deprecated pid, but pid is still can be used, it's deprecated, not removed, please revert this change |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.