diff --git a/src/main/java/org/prebid/server/floors/BasicPriceFloorResolver.java b/src/main/java/org/prebid/server/floors/BasicPriceFloorResolver.java index fedb85aa58c..6ce588f9c68 100644 --- a/src/main/java/org/prebid/server/floors/BasicPriceFloorResolver.java +++ b/src/main/java/org/prebid/server/floors/BasicPriceFloorResolver.java @@ -512,7 +512,8 @@ private Price resolveFloorMin(BidRequest bidRequest, Imp imp, List warni final BigDecimal requestFloorMin = floorRules.map(PriceFloorRules::getFloorMin).orElse(null); final String requestFloorMinCur = floorRules.map(PriceFloorRules::getFloorMinCur).orElse(null); - if (impFloorMinCur != null && !impFloorMinCur.equals(requestFloorMinCur)) { + if (ObjectUtils.allNotNull(impFloorMinCur, requestFloorMinCur) + && !impFloorMinCur.equals(requestFloorMinCur)) { warnings.add("imp[].ext.prebid.floors.floorMinCur and ext.prebid.floors.floorMinCur has different values"); } diff --git a/src/test/java/org/prebid/server/floors/BasicPriceFloorResolverTest.java b/src/test/java/org/prebid/server/floors/BasicPriceFloorResolverTest.java index 0f8ce024680..231963ade01 100644 --- a/src/test/java/org/prebid/server/floors/BasicPriceFloorResolverTest.java +++ b/src/test/java/org/prebid/server/floors/BasicPriceFloorResolverTest.java @@ -1435,6 +1435,39 @@ public void resolveShouldEmitWarningIfRequestFloorMinCurIsDifferentFromImpFloorM + "ext.prebid.floors.floorMinCur has different values"); } + @Test + public void resolveShouldNotEmitWarningIfRequestFloorMinCurIsNull() { + // given + final BidRequest bidRequest = BidRequest.builder() + .app(App.builder() + .publisher(Publisher.builder().domain("appDomain").build()) + .build()) + .ext(ExtRequest.of(ExtRequestPrebid.builder() + .floors(PriceFloorRules.builder() + .floorMin(BigDecimal.ONE) + .build()) + .build())) + .build(); + final JsonNode impFloorsNode = mapper.valueToTree(ExtImpPrebidFloors.of( + null, null, null, BigDecimal.TEN, "USD")); + final ObjectNode givenImpExt = mapper.createObjectNode(); + final ObjectNode givenImpExtPrebid = mapper.createObjectNode(); + givenImpExtPrebid.set("floors", impFloorsNode); + givenImpExt.set("prebid", givenImpExtPrebid); + + // when + final List warnings = new ArrayList<>(); + priceFloorResolver.resolve(bidRequest, + givenRules(PriceFloorModelGroup.builder() + .schema(PriceFloorSchema.of("|", singletonList(PriceFloorField.pubDomain))) + .value("appDomain", BigDecimal.ONE) + .build()), + givenImp(impBuilder -> impBuilder.ext(givenImpExt)), warnings); + + // then + assertThat(warnings).isEmpty(); + } + @Test public void resolveShouldReturnConvertedFloorMinInProvidedCurrencyAndFloorMinMoreThanFloor() { // given