Skip to content

Commit

Permalink
Addressing requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
William Harris committed Mar 5, 2024
1 parent 3c57c36 commit 07acc54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class YieldlabBidder implements Bidder<Void> {
Expand Down Expand Up @@ -250,7 +249,7 @@ private static Map<String, String> extractDsaRequestParamsFromBidRequest(BidRequ
.map(Regs::getExt)
.map(ExtRegs::getDsa)
.map(YieldlabBidder::extractDsaRequestParamsFromDsaRegsExtension)
.orElse(Map.of());
.orElseGet(Map::of);
}

private static Map<String, String> extractDsaRequestParamsFromDsaRegsExtension(final ExtRegsDsa dsa) {
Expand All @@ -273,21 +272,18 @@ private static Map<String, String> extractDsaRequestParamsFromDsaRegsExtension(f
dsaRequestParams.put("dsatransparency", encodeTransparenciesAsString(dsaTransparency));
}

return dsaRequestParams.entrySet().stream()
.filter(entry -> !entry.getValue().isBlank())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
return dsaRequestParams;
}

private static String encodeTransparenciesAsString(List<ExtRegsDsaTransparency> transparencies) {
return transparencies.stream()
.filter(transparencyIsValid())
.filter(YieldlabBidder::transparencyIsValid)
.map(YieldlabBidder::encodeTransparency)
.collect(Collectors.joining(TRANSPARENCY_TEMPLATE_DELIMITER));
}

private static Predicate<ExtRegsDsaTransparency> transparencyIsValid() {
return transparency ->
!Objects.isNull(transparency.getDomain())
private static boolean transparencyIsValid(ExtRegsDsaTransparency transparency) {
return transparency.getDomain() != null
&& !Objects.isNull(transparency.getDsaParams())
&& !transparency.getDsaParams().isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class YieldlabDigitalServicesActResponse {
List<Transparency> transparency;

@AllArgsConstructor(staticName = "of")
@Value
@Value(staticConstructor = "of")
public static class Transparency {
String domain;
List<Integer> dsaparams;
Expand Down

0 comments on commit 07acc54

Please sign in to comment.