diff --git a/src/main/java/org/prebid/server/auction/ExchangeService.java b/src/main/java/org/prebid/server/auction/ExchangeService.java index 4b8a66b6058..bb6dfb17646 100644 --- a/src/main/java/org/prebid/server/auction/ExchangeService.java +++ b/src/main/java/org/prebid/server/auction/ExchangeService.java @@ -903,9 +903,7 @@ price, currencyRates(bidRequest), adServerCurrency, } updatedBidderBids.add(bidderBid); } catch (PreBidException e) { - errors.add(BidderError.generic( - String.format("Unable to covert bid currency %s to desired ad server currency %s. %s", - bidCurrency, adServerCurrency, e.getMessage()))); + errors.add(BidderError.generic(e.getMessage())); } } diff --git a/src/main/java/org/prebid/server/currency/CurrencyConversionService.java b/src/main/java/org/prebid/server/currency/CurrencyConversionService.java index 34912e03d19..8645c86d458 100644 --- a/src/main/java/org/prebid/server/currency/CurrencyConversionService.java +++ b/src/main/java/org/prebid/server/currency/CurrencyConversionService.java @@ -172,7 +172,9 @@ public BigDecimal convertCurrency(BigDecimal price, Map currencyConversionService.convertCurrency(BigDecimal.ONE, null, EUR, GBP, false)) - .withMessage("no currency conversion available"); + .withMessage("Unable to convert bid currency GBP to desired ad server currency EUR"); } @Test @@ -239,7 +239,7 @@ public void convertCurrencyShouldThrowPrebidExceptionIfServerAndRequestRatesAreN // when and then assertThatExceptionOfType(PreBidException.class) .isThrownBy(() -> currencyService.convertCurrency(BigDecimal.ONE, null, USD, EUR, false)) - .withMessage("no currency conversion available"); + .withMessage("Unable to convert bid currency EUR to desired ad server currency USD"); } @Test @@ -257,7 +257,7 @@ public void convertCurrencyShouldThrowPrebidExceptionIfMultiplierWasNotFoundFrom assertThatExceptionOfType(PreBidException.class) .isThrownBy(() -> currencyService.convertCurrency(BigDecimal.ONE, requestConversionRates, EUR, AUD, false)) - .withMessage("no currency conversion available"); + .withMessage("Unable to convert bid currency AUD to desired ad server currency EUR"); } @Test @@ -271,7 +271,7 @@ public void convertCurrencyShouldThrowExceptionWhenCurrencyServerResponseStatusN // then assertThatExceptionOfType(PreBidException.class) .isThrownBy(() -> currencyService.convertCurrency(BigDecimal.ONE, null, UAH, AUD, false)) - .withMessage("no currency conversion available"); + .withMessage("Unable to convert bid currency AUD to desired ad server currency UAH"); } @Test @@ -285,7 +285,7 @@ public void convertCurrencyShouldThrowExceptionWhenCurrencyServerResponseContain // then assertThatExceptionOfType(PreBidException.class) .isThrownBy(() -> currencyService.convertCurrency(BigDecimal.ONE, null, UAH, AUD, false)) - .withMessage("no currency conversion available"); + .withMessage("Unable to convert bid currency AUD to desired ad server currency UAH"); } @SuppressWarnings("unchecked") diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 10898988e58..47aa5684387 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -1879,7 +1879,7 @@ public void shouldDropBidIfPrebidExceptionWasThrownDuringCurrencyConversion() { identity()); given(currencyService.convertCurrency(any(), any(), any(), any(), any())) - .willThrow(new PreBidException("no currency conversion available")); + .willThrow(new PreBidException("Unable to convert bid currency CUR to desired ad server currency USD")); // when exchangeService.holdAuction(givenRequestContext(bidRequest)).result(); @@ -1890,8 +1890,8 @@ public void shouldDropBidIfPrebidExceptionWasThrownDuringCurrencyConversion() { assertThat(argumentCaptor.getValue()).hasSize(1); - final BidderError expectedError = BidderError.generic("Unable to covert bid currency CUR to desired ad" - + " server currency USD. no currency conversion available"); + final BidderError expectedError = + BidderError.generic("Unable to convert bid currency CUR to desired ad server currency USD"); final BidderSeatBid firstSeatBid = argumentCaptor.getValue().get(0).getSeatBid(); assertThat(firstSeatBid.getBids()).isEmpty(); assertThat(firstSeatBid.getErrors()).containsOnly(expectedError); @@ -1948,7 +1948,8 @@ public void shouldUpdatePriceForOneBidAndDropAnotherIfPrebidExceptionHappensForS final BigDecimal updatedPrice = BigDecimal.valueOf(10.0); given(currencyService.convertCurrency(any(), any(), any(), any(), any())).willReturn(updatedPrice) - .willThrow(new PreBidException("no currency conversion available")); + .willThrow( + new PreBidException("Unable to convert bid currency CUR2 to desired ad server currency USD")); // when exchangeService.holdAuction(givenRequestContext(bidRequest)).result(); @@ -1963,8 +1964,8 @@ public void shouldUpdatePriceForOneBidAndDropAnotherIfPrebidExceptionHappensForS final Bid expectedBid = Bid.builder().price(updatedPrice).build(); final BidderBid expectedBidderBid = BidderBid.of(expectedBid, banner, "CUR1"); - final BidderError expectedError = BidderError.generic("Unable to covert bid currency CUR2 to desired ad" - + " server currency USD. no currency conversion available"); + final BidderError expectedError = + BidderError.generic("Unable to convert bid currency CUR2 to desired ad server currency USD"); final BidderSeatBid firstSeatBid = argumentCaptor.getValue().get(0).getSeatBid(); assertThat(firstSeatBid.getBids()).containsOnly(expectedBidderBid); @@ -1989,7 +1990,7 @@ public void shouldRespondWithOneBidAndErrorWhenBidResponseContainsOneUnsupported final BigDecimal updatedPrice = BigDecimal.valueOf(20); given(currencyService.convertCurrency(any(), any(), any(), any(), any())).willReturn(updatedPrice); given(currencyService.convertCurrency(any(), any(), eq("BAD"), eq("CUR"), any())) - .willThrow(new PreBidException("no currency conversion available")); + .willThrow(new PreBidException("Unable to convert bid currency CUR to desired ad server currency BAD")); // when exchangeService.holdAuction(givenRequestContext(bidRequest)).result(); @@ -2009,8 +2010,8 @@ public void shouldRespondWithOneBidAndErrorWhenBidResponseContainsOneUnsupported .flatExtracting(BidderSeatBid::getBids) .containsOnly(expectedBidderBid); - final BidderError expectedError = BidderError.generic("Unable to covert bid currency CUR to desired ad" - + " server currency BAD. no currency conversion available"); + final BidderError expectedError = + BidderError.generic("Unable to convert bid currency CUR to desired ad server currency BAD"); assertThat(argumentCaptor.getValue()) .extracting(BidderResponse::getSeatBid) .flatExtracting(BidderSeatBid::getErrors)