Skip to content

[JITERA] Feature: Add Vietnamese Dong (VND) to Currency Conversion Module

chi le requested to merge feat/add-vnd-currency-1750232449 into master

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

  1. Updated ExchangeRatesServiceImpl:
    • Modified the getCurrentRates method to include VND in the returned exchange rates.
    • Ensured that the conversion logic can handle VND by fetching its rate from the ExchangeRatesContainer.

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.

Merge request reports