Skip to content

Conversation

@AntoxaAntoxic
Copy link
Collaborator

🔧 Type of changes

  • new bid adapter
  • bid adapter update
  • new feature
  • new analytics adapter
  • new module
  • module update
  • bugfix
  • documentation
  • configuration
  • dependency update
  • tech debt (test coverage, refactorings, etc.)

✨ What's the context?

What's the context for the changes?

🧠 Rationale behind the change

Why did you choose to make these changes? Were there any trade-offs you had to consider?

🔎 New Bid Adapter Checklist

  • verify email contact works
  • NO fully dynamic hostnames
  • geographic host parameters are NOT required
  • direct use of HTTP is prohibited - implement an existing Bidder interface that will do all the job
  • if the ORTB is just forwarded to the endpoint, use the generic adapter - define the new adapter as the alias of the generic adapter
  • cover an adapter configuration with an integration test

🧪 Test plan

How do you know the changes are safe to ship to production?

🏎 Quality check

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

…justments-for-price-floors

# Conflicts:
#	src/main/java/org/prebid/server/bidadjustments/BidAdjustmentFactorResolver.java
#	src/main/java/org/prebid/server/bidadjustments/BidAdjustmentsProcessor.java
#	src/test/java/org/prebid/server/bidadjustments/BidAdjustmentFactorResolverTest.java
#	src/test/java/org/prebid/server/bidadjustments/BidAdjustmentsProcessorTest.java
@osulzhenko osulzhenko requested a review from CTMBNara April 25, 2025 08:00
@osulzhenko osulzhenko added the do not merge Not the time for merging yet label May 9, 2025
@AntoxaAntoxic AntoxaAntoxic added do not merge Not the time for merging yet and removed do not merge Not the time for merging yet labels May 15, 2025
Comment on lines +64 to +89
private Price reversePrice(Price price,
List<BidAdjustmentsRule> bidAdjustmentRules,
BidRequest bidRequest) {

final List<BidAdjustmentsRule> reversedRules = bidAdjustmentRules.reversed();
final String resolvedCurrency = price.getCurrency();
BigDecimal resolvedPrice = price.getValue();

for (BidAdjustmentsRule rule : reversedRules) {
final BidAdjustmentType adjustmentType = rule.getAdjType();
final BigDecimal adjustmentValue = rule.getValue();
final String adjustmentCurrency = rule.getCurrency();

switch (adjustmentType) {
case MULTIPLIER -> resolvedPrice = resolvedPrice.divide(adjustmentValue, 4, RoundingMode.HALF_EVEN);
case CPM -> {
final BigDecimal convertedAdjustmentValue = currencyService.convertCurrency(
adjustmentValue, bidRequest, adjustmentCurrency, resolvedCurrency);
resolvedPrice = BidderUtil.roundFloor(resolvedPrice.add(convertedAdjustmentValue));
}
case STATIC -> throw new PreBidException("STATIC type can't be applied to a floor price");
}
}

return Price.of(resolvedCurrency, resolvedPrice);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to extract this method and BidAdjustmentsResolver.adjustPrice into a separate class so that both methods are in the same place. Also, then you can add a test that checks that

reverse(apply(price)) == price

Copy link
Collaborator Author

@AntoxaAntoxic AntoxaAntoxic Jun 2, 2025

Choose a reason for hiding this comment

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

@CTMBNara Not sure I like the idea. The check you suggested is more relevant to the integration/functional tests than unit tests, since this check is about the integrity. Also adjusting and reversing are not the same because of the static adjustment, so the check doesn't hit 100% success rate - it's more likely a use case for the functional test to set it up correctly and check.

AntoxaAntoxic and others added 2 commits June 4, 2025 11:56
Co-authored-by: Markiyan Mykush <[email protected]>
Co-authored-by: markiian <[email protected]>
Co-authored-by: osulzhenko <[email protected]>
@osulzhenko osulzhenko removed the do not merge Not the time for merging yet label Jun 4, 2025
CTMBNara
CTMBNara previously approved these changes Jun 4, 2025
…-price-floors

# Conflicts:
#	src/main/java/org/prebid/server/auction/ExchangeService.java
@CTMBNara CTMBNara merged commit 8a86567 into master Jun 6, 2025
8 checks passed
@CTMBNara CTMBNara deleted the bid-adjustments-for-price-floors branch June 6, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants