Skip to content
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 @@ -394,7 +394,7 @@ private Bid createBid(AdnuntiusAd ad, BidRequest bidRequest, String adm, String
.crid(ad.getCreativeId())
.price(resolvePrice(ad, bidType))
.adm(adm)
.adomain(extractDomain(ad.getDestinationUrls()))
.adomain(ad.getAdvertiserDomains())
.ext(bidExt == null ? null : mapper.mapper().valueToTree(bidExt))
.build();
}
Expand Down Expand Up @@ -444,13 +444,4 @@ private static BigDecimal resolvePrice(AdnuntiusAd ad, String bidType) {

return amount != null ? amount.multiply(PRICE_MULTIPLIER) : BigDecimal.ZERO;
}

private static List<String> extractDomain(Map<String, String> destinationUrls) {
return destinationUrls == null ? Collections.emptyList() : destinationUrls.values().stream()
.filter(Objects::nonNull)
.map(url -> url.split("/"))
.filter(splintedUrl -> splintedUrl.length >= 2)
.map(splintedUrl -> StringUtils.replace(splintedUrl[2], "www.", ""))
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Builder;
import lombok.Value;

import java.util.List;
import java.util.Map;

@Builder
Expand Down Expand Up @@ -41,5 +42,8 @@ public class AdnuntiusAd {
@JsonProperty("destinationUrls")
Map<String, String> destinationUrls;

Comment on lines 42 to 44
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

destinationUrls looks like unused, can we remove them?

Copy link
Collaborator Author

@przemkaczmarek przemkaczmarek Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's unused. In Go they didnt remove it so didnt I.

@JsonProperty("advertiserDomains")
List<String> advertiserDomains;

AdnuntiusAdvertiser advertiser;
}
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,7 @@ public void makeBidsShouldReturnTwoBidFromDealsAndAdsWhenAdsAndDealsIsSpecified(
.lineItemId("lineItemId")
.dealId("dealId")
.advertiser(AdnuntiusAdvertiser.of(null, "name"))
.destinationUrls(Map.of(
"key1", "https://www.domain1.com/uri",
"key2", "http://www.domain2.dt/uri")))),
.advertiserDomains(List.of("domain1.com", "domain2.dt")))),
List.of(givenAd(ad -> ad
.bid(AdnuntiusBid.of(BigDecimal.ONE, "USD"))
.adId("adId")
Expand All @@ -762,9 +760,7 @@ public void makeBidsShouldReturnTwoBidFromDealsAndAdsWhenAdsAndDealsIsSpecified(
.dealId("dealId")
.html("dealHtml")
.advertiser(AdnuntiusAdvertiser.of("legalName", "name"))
.destinationUrls(Map.of(
"key1", "https://www.domain1.com/uri",
"key2", "http://www.domain2.dt/uri"))))));
.advertiserDomains(List.of("domain1.com", "domain2.dt"))))));

final BidRequest bidRequest = givenBidRequest(givenImp(
ExtImpAdnuntius.builder().auId("auId").build(), identity()));
Expand Down Expand Up @@ -900,9 +896,7 @@ public void makeBidsShouldReturnCorrectSeatBids() throws JsonProcessingException
.creativeId("creativeId")
.lineItemId("lineItemId")
.dealId("dealId")
.destinationUrls(Map.of(
"key1", "https://www.domain1.com/uri",
"key2", "http://www.domain2.dt/uri")))));
.advertiserDomains(List.of("domain1.com", "domain2.dt")))));

final BidRequest bidRequest = givenBidRequest(
givenImp(ExtImpAdnuntius.builder().auId("auId").build(), identity()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"creativeId": "some_creative_id",
"lineItemId": "some_line_item_id",
"dealId": "some_deal_id",
"destinationUrls": {
"some_url": "https://www.domain.dm/uri"
}
"advertiserDomains": [
"domain.dm"
]
}
]
}
Expand Down
Loading