Skip to content

Commit

Permalink
[MODORDERS-989] - Rounding for the total estimated price of the order…
Browse files Browse the repository at this point in the history
… line does not work after the rollover (#825)
  • Loading branch information
Abdulkhakimov authored Jan 25, 2024
1 parent d250836 commit 526b6c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ private CurrencyConversion retrieveCurrencyConversion(String systemCurrency, PoL
}

private MonetaryAmount amountWithConversion(BigDecimal totalInitialAmountEncumbered, PoLineEncumbrancesHolder holder) {
return Money.of(totalInitialAmountEncumbered, holder.getPoLine().getCost().getCurrency()).with(holder.getCurrencyConversion());
return Money.of(totalInitialAmountEncumbered, holder.getPoLine().getCost().getCurrency())
.with(holder.getCurrencyConversion())
.with(Monetary.getDefaultRounding());
}

private List<PoLineEncumbrancesHolder> buildPoLineEncumbrancesHolders(String systemCurrency, List<PoLine> poLines,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,9 @@ void shouldUpdateOrderLinesCostAndEncumbranceLinksWithExchangeRateAndPolCurrency
assertThat(fundDistributionOngoing2.getEncumbrance(), equalTo(currEncumbrId2));
assertThat(fundDistributionOngoing3.getEncumbrance(), equalTo(currEncumbrId3));

assertThat(BigDecimal.valueOf(costOneTime.getPoLineEstimatedPrice()).setScale(2, RoundingMode.HALF_EVEN),
equalTo(new BigDecimal("24.99").setScale(2, RoundingMode.HALF_EVEN)));
assertThat(BigDecimal.valueOf(costOngoing2.getPoLineEstimatedPrice()).setScale(2, RoundingMode.HALF_EVEN),
equalTo(new BigDecimal("24.99").setScale(2, RoundingMode.HALF_EVEN)));
assertThat(BigDecimal.valueOf(costOngoing3.getPoLineEstimatedPrice()).setScale(2, RoundingMode.HALF_EVEN),
equalTo(new BigDecimal("24.99").setScale(2, RoundingMode.HALF_EVEN)));
assertThat(BigDecimal.valueOf(costOneTime.getPoLineEstimatedPrice()), equalTo(new BigDecimal("24.99")));
assertThat(BigDecimal.valueOf(costOngoing2.getPoLineEstimatedPrice()), equalTo(new BigDecimal("24.99")));
assertThat(BigDecimal.valueOf(costOngoing3.getPoLineEstimatedPrice()), equalTo(new BigDecimal("24.99")));

assertThat(costOneTime.getFyroAdjustmentAmount(), equalTo(0.0d));
assertThat(costOngoing2.getFyroAdjustmentAmount(), equalTo(0.0d));
Expand Down

0 comments on commit 526b6c6

Please sign in to comment.