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

Fix: Revert predicate logic #3006

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -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
Loading