Skip to content

Commit

Permalink
Use bidfloor if set - prebid.js adapter behavior (PBID-1309) (#1218)
Browse files Browse the repository at this point in the history
- Fixes bug that set bidfloor to 0 when customFloor not given (so almost always)
- Implements behavior in https://github.com/prebid/Prebid.js/blob/master/modules/openxBidAdapter.js#L495
  • Loading branch information
laurb9 authored and nickluck8 committed Aug 10, 2021
1 parent 60905da commit e5d3ae2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.iab.openrtb.response.SeatBid;
import io.vertx.core.http.HttpMethod;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.prebid.server.bidder.Bidder;
import org.prebid.server.bidder.model.BidderBid;
Expand Down Expand Up @@ -159,7 +160,7 @@ private Imp makeImp(Imp imp) {
final ExtImpPrebid prebidImpExt = impExt.getPrebid();
final Imp.ImpBuilder impBuilder = imp.toBuilder()
.tagid(openxImpExt.getUnit())
.bidfloor(openxImpExt.getCustomFloor())
.bidfloor(ObjectUtils.defaultIfNull(imp.getBidfloor(), openxImpExt.getCustomFloor()))
.ext(makeImpExt(openxImpExt.getCustomParams()));

if (resolveImpType(imp) == OpenxImpType.video
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,17 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.imp(asList(
Imp.builder()
.id("impId1")
.bidfloor(BigDecimal.valueOf(0.5))
.banner(Banner.builder().build())
.ext(mapper.valueToTree(
ExtPrebid.of(null,
ExtImpOpenx.builder()
.customFloor(BigDecimal.valueOf(0.1))
.customParams(givenCustomParams("foo1", singletonList("bar1")))
.delDomain("se-demo-d.openx.net")
.unit("unitId").build()))).build(),
Imp.builder()
.id("impId2")
.bidfloor(BigDecimal.valueOf(0.5))
.banner(Banner.builder().build())
.ext(mapper.valueToTree(
ExtPrebid.of(null,
Expand All @@ -237,7 +238,6 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.ext(mapper.valueToTree(
ExtPrebid.of(null,
ExtImpOpenx.builder()
.customFloor(BigDecimal.valueOf(0.1))
.customParams(givenCustomParams("foo4", "bar4"))
.platform("PLATFORM")
.unit("unitId").build()))).build(),
Expand Down Expand Up @@ -266,7 +266,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.id("impId1")
.banner(Banner.builder().build())
.tagid("unitId")
.bidfloor(BigDecimal.valueOf(0.1))
.bidfloor(BigDecimal.valueOf(0.5))
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
.customParams(
Expand All @@ -278,7 +278,7 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.id("impId2")
.banner(Banner.builder().build())
.tagid("unitId")
.bidfloor(BigDecimal.valueOf(0.1))
.bidfloor(BigDecimal.valueOf(0.5))
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
.customParams(
Expand Down Expand Up @@ -328,7 +328,6 @@ public void makeHttpRequestsShouldReturnResultWithExpectedFieldsSet() {
.id("impId4")
.video(Video.builder().build())
.tagid("unitId")
.bidfloor(BigDecimal.valueOf(0.1))
.ext(mapper.valueToTree(
ExtImpOpenx.builder()
.customParams(
Expand Down

0 comments on commit e5d3ae2

Please sign in to comment.