[JITERA] Feature: Add Vietnamese Dong (VND) to Currency Conversion Module
Created by: chi-jitera
Overview
This pull request introduces the Vietnamese Dong (VND) to the currency conversion module. The Currency enum already includes VND, and the conversion logic has been updated to handle VND rates.
Changes
-
Updated
ExchangeRatesServiceImpl:- Modified the
getCurrentRatesmethod to include VND in the returned exchange rates. - Ensured that the conversion logic can handle VND by fetching its rate from the
ExchangeRatesContainer.
- Modified the
Code Changes
@Override
public Map getCurrentRates() {
if (container == null || !container.getDate().equals(LocalDate.now())) {
container = client.getRates(Currency.getBase());
log.info("exchange rates has been updated: {}", container);
}
return ImmutableMap.of(
Currency.EUR, container.getRates().get(Currency.EUR.name()),
Currency.RUB, container.getRates().get(Currency.RUB.name()),
Currency.USD, BigDecimal.ONE,
Currency.VND, container.getRates().get(Currency.VND.name()) // Added VND
);
}
This ensures that VND is now part of the currency conversion logic, allowing users to convert to and from VND seamlessly.