4242import org .prebid .server .proto .openrtb .ext .response .ExtBidPrebid ;
4343import org .prebid .server .proto .openrtb .ext .response .ExtBidPrebidVideo ;
4444import org .prebid .server .settings .ApplicationSettings ;
45+ import org .prebid .server .settings .model .Account ;
4546import org .prebid .server .util .ObjectUtil ;
4647
4748import java .math .BigDecimal ;
@@ -83,6 +84,7 @@ public BasicCategoryMappingService(ApplicationSettings applicationSettings, Jack
8384 @ Override
8485 public Future <CategoryMappingResult > createCategoryMapping (List <BidderResponse > bidderResponses ,
8586 BidRequest bidRequest ,
87+ Account account ,
8688 Timeout timeout ) {
8789
8890 final ExtRequestTargeting targeting = targeting (bidRequest );
@@ -110,9 +112,21 @@ public Future<CategoryMappingResult> createCategoryMapping(List<BidderResponse>
110112 final List <RejectedBid > rejectedBids = new ArrayList <>();
111113
112114 return makeBidderToBidCategory (
113- bidderResponses , withCategory , translateCategories , primaryAdServer , publisher , rejectedBids , timeout )
115+ bidderResponses ,
116+ withCategory ,
117+ translateCategories ,
118+ primaryAdServer ,
119+ publisher ,
120+ rejectedBids ,
121+ timeout )
114122 .map (categoryBidContexts -> resolveBidsCategoriesDurations (
115- bidderResponses , categoryBidContexts , bidRequest , targeting , withCategory , rejectedBids ));
123+ bidderResponses ,
124+ categoryBidContexts ,
125+ account ,
126+ bidRequest ,
127+ targeting ,
128+ withCategory ,
129+ rejectedBids ));
116130 }
117131
118132 private static ExtRequestTargeting targeting (BidRequest bidRequest ) {
@@ -326,6 +340,7 @@ private static void collectCategoryFetchResults(CompositeFuture compositeFuture,
326340 */
327341 private CategoryMappingResult resolveBidsCategoriesDurations (List <BidderResponse > bidderResponses ,
328342 List <CategoryBidContext > categoryBidContexts ,
343+ Account account ,
329344 BidRequest bidRequest ,
330345 ExtRequestTargeting targeting ,
331346 boolean withCategory ,
@@ -342,8 +357,15 @@ private CategoryMappingResult resolveBidsCategoriesDurations(List<BidderResponse
342357
343358 final boolean appendBidderNames = BooleanUtils .toBooleanDefaultIfNull (targeting .getAppendbiddernames (), false );
344359 final Map <String , Set <CategoryBidContext >> uniqueCatKeysToCategoryBids = categoryBidContexts .stream ()
345- .map (categoryBidContext -> enrichCategoryBidContext (categoryBidContext , durations , priceGranularity ,
346- withCategory , appendBidderNames , impIdToBiddersDealTear , rejectedBids ))
360+ .map (categoryBidContext -> enrichCategoryBidContext (
361+ categoryBidContext ,
362+ account ,
363+ durations ,
364+ priceGranularity ,
365+ withCategory ,
366+ appendBidderNames ,
367+ impIdToBiddersDealTear ,
368+ rejectedBids ))
347369 .filter (Objects ::nonNull )
348370 .collect (Collectors .groupingBy (CategoryBidContext ::getCategoryUniqueKey ,
349371 Collectors .mapping (Function .identity (), Collectors .toSet ())));
@@ -504,6 +526,7 @@ private static boolean isNotRejected(String bidId, String bidder, List<RejectedB
504526 * and creates {@link CategoryBidContext} which is holder for bid category related information.
505527 */
506528 private CategoryBidContext enrichCategoryBidContext (CategoryBidContext categoryBidContext ,
529+ Account account ,
507530 List <Integer > durations ,
508531 PriceGranularity priceGranularity ,
509532 boolean withCategory ,
@@ -522,7 +545,7 @@ private CategoryBidContext enrichCategoryBidContext(CategoryBidContext categoryB
522545 return null ;
523546 }
524547
525- final BigDecimal price = CpmRange .fromCpmAsNumber (bid .getPrice (), priceGranularity );
548+ final BigDecimal price = CpmRange .fromCpmAsNumber (bid .getPrice (), priceGranularity , account );
526549 final String rowPrice = CpmRange .format (price , priceGranularity .getPrecision ());
527550 final String category = categoryBidContext .getCategory ();
528551 final String categoryUniqueKey = createCategoryUniqueKey (withCategory , category , rowPrice , duration );
0 commit comments