public BigDecimal calculateFinalAmount(BigDecimal originalAmount, String fromCurrency, String toCurrency) {
BigDecimal finalAmount;
BigDecimal temporaryAmount;
BigDecimal fromCurrencyExchangeRate = exchangeRateService.getCurrentExchangeRate(fromCurrency);
temporaryAmount = originalAmount.multiply(fromCurrencyExchangeRate);
BigDecimal toCurrencyExchangeRate = exchangeRateService.getCurrentExchangeRate(toCurrency);
if (temporaryAmount.compareTo(toCurrencyExchangeRate) > 0) {
finalAmount = temporaryAmount.divide(toCurrencyExchangeRate, 2, RoundingMode.HALF_UP);
} else {
finalAmount = temporaryAmount.multiply(toCurrencyExchangeRate);
}
return finalAmount;
}