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

Conversant: fix bid floor #1291

Merged
merged 3 commits into from
Jun 3, 2021
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.prebid.server.proto.openrtb.ext.response.BidType;
import org.prebid.server.util.HttpUtil;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -138,14 +139,26 @@ private static Imp modifyImp(Imp imp, ExtImpConversant impExt) {
return imp.toBuilder()
.displaymanager(DISPLAY_MANAGER)
.displaymanagerver(DISPLAY_MANAGER_VER)
.bidfloor(impExt.getBidfloor())
.bidfloor(getBidFloor(imp, impExt))
.tagid(impExt.getTagId())
nickluck8 marked this conversation as resolved.
Show resolved Hide resolved
.secure(getSecure(imp, impExt))
.banner(modifyBanner(banner, impExt.getPosition()))
.video(video != null && banner == null ? modifyVideo(video, impExt) : video)
.build();
}

private static BigDecimal getBidFloor(Imp imp, ExtImpConversant impExt) {
nickluck8 marked this conversation as resolved.
Show resolved Hide resolved
BigDecimal impBidFloor = imp.getBidfloor() == null ? new BigDecimal(0.00) : imp.getBidfloor();
nickluck8 marked this conversation as resolved.
Show resolved Hide resolved

if (impExt.getBidfloor() != null
&& impBidFloor.compareTo(BigDecimal.ZERO) <= 0
&& impExt.getBidfloor().compareTo(BigDecimal.ZERO) > 0) {
return impExt.getBidfloor();
}

return null;
nickluck8 marked this conversation as resolved.
Show resolved Hide resolved
}

private static Integer getSecure(Imp imp, ExtImpConversant impExt) {
final Integer extSecure = impExt.getSecure();
final Integer impSecure = imp.getSecure();
Expand Down