Skip to content

Commit

Permalink
Core: Revert predicate logic. (#3006)
Browse files Browse the repository at this point in the history
  • Loading branch information
CTMBNara authored Feb 22, 2024
1 parent 80c27cf commit 1da4961
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ private Price resolveFloorMin(BidRequest bidRequest, Imp imp, List<String> 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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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
Expand Down

0 comments on commit 1da4961

Please sign in to comment.