diff --git a/pom.xml b/pom.xml index 97a6e07..e51ae3f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,124 +1,124 @@ - - - 4.0.0 - - io.ljunggren - exchange-rate-api - 0.0.1-SNAPSHOT - - exchange-rate-api - - - UTF-8 - 17 - - - - - - org.junit - junit-bom - 5.11.0 - pom - import - - - - - - - org.apache.httpcomponents.client5 - httpclient5 - 5.5 - - - com.fasterxml.jackson.core - jackson-annotations - 2.20 - - - org.apache.commons - commons-lang3 - 3.18.0 - - - commons-io - commons-io - 2.20.0 - - - io.ljunggren - json-utils - 0.0.1-SNAPSHOT - - - org.projectlombok - lombok - 1.18.38 - provided - - - org.junit.jupiter - junit-jupiter-api - test - - - - org.junit.jupiter - junit-jupiter-params - test - - - - - - - - - maven-clean-plugin - 3.4.0 - - - - maven-resources-plugin - 3.3.1 - - - maven-compiler-plugin - 3.13.0 - - - maven-surefire-plugin - 3.3.0 - - - maven-jar-plugin - 3.4.2 - - - maven-install-plugin - 3.1.2 - - - maven-deploy-plugin - 3.1.2 - - - - maven-site-plugin - 3.12.1 - - - maven-project-info-reports-plugin - 3.6.1 - - - - - + + + 4.0.0 + + io.ljunggren + exchange-rate-api + 0.0.1-SNAPSHOT + + exchange-rate-api + + + UTF-8 + 17 + + + + + + org.junit + junit-bom + 5.11.0 + pom + import + + + + + + + org.apache.httpcomponents.client5 + httpclient5 + 5.5 + + + com.fasterxml.jackson.core + jackson-annotations + 2.20 + + + org.apache.commons + commons-lang3 + 3.18.0 + + + commons-io + commons-io + 2.20.0 + + + io.ljunggren + json-utils + 0.0.1-SNAPSHOT + + + org.projectlombok + lombok + 1.18.38 + provided + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-params + test + + + + + + + + + maven-clean-plugin + 3.4.0 + + + + maven-resources-plugin + 3.3.1 + + + maven-compiler-plugin + 3.13.0 + + + maven-surefire-plugin + 3.3.0 + + + maven-jar-plugin + 3.4.2 + + + maven-install-plugin + 3.1.2 + + + maven-deploy-plugin + 3.1.2 + + + + maven-site-plugin + 3.12.1 + + + maven-project-info-reports-plugin + 3.6.1 + + + + + diff --git a/src/main/java/io/ljunggren/exchange/rate/api/ExchangeRateApi.java b/src/main/java/io/ljunggren/exchange/rate/api/ExchangeRateApi.java index d897adb..c5484ed 100644 --- a/src/main/java/io/ljunggren/exchange/rate/api/ExchangeRateApi.java +++ b/src/main/java/io/ljunggren/exchange/rate/api/ExchangeRateApi.java @@ -1,27 +1,37 @@ -package io.ljunggren.exchange.rate.api; - -import org.apache.commons.lang3.StringUtils; - -import io.ljunggren.exchange.rate.api.exception.ExchangeRateException; -import io.ljunggren.exchange.rate.api.model.ExchangeRate; -import io.ljunggren.exchange.rate.api.service.ExchangeRateService; - -public class ExchangeRateApi { - - private ExchangeRateService exchangeRateService; - - public ExchangeRateApi() { - this.exchangeRateService = new ExchangeRateService(); - } - - public ExchangeRate getByCurrency(String currency) throws ExchangeRateException { - if (StringUtils.isBlank(currency)) { - throw new ExchangeRateException("Currency is required"); - } - if (!currency.matches("^[a-zA-Z]{3}$")) { - throw new ExchangeRateException("Currency must be 3 letters"); - } - return exchangeRateService.getByCurrency(currency); - } - -} +package io.ljunggren.exchange.rate.api; + +import org.apache.commons.lang3.StringUtils; + +import io.ljunggren.exchange.rate.api.exception.ExchangeRateException; +import io.ljunggren.exchange.rate.api.model.ExchangeRate; +import io.ljunggren.exchange.rate.api.model.SupportedCodes; +import io.ljunggren.exchange.rate.api.service.ExchangeRateService; +import io.ljunggren.exchange.rate.api.service.SupportedCodesService; + +public class ExchangeRateApi { + + private ExchangeRateService exchangeRateService; + private SupportedCodesService supportedCodesService; + + public ExchangeRateApi(String apiKey) { + this.exchangeRateService = new ExchangeRateService(); + this.supportedCodesService = new SupportedCodesService(apiKey); + } + + public ExchangeRate getByCurrency(String currency) throws ExchangeRateException { + if (StringUtils.isBlank(currency)) { + throw new ExchangeRateException("Currency is required"); + } + if (!currency.matches("^[a-zA-Z]{3}$")) { + throw new ExchangeRateException("Currency must be 3 letters"); + } + ExchangeRate exchangeRate = exchangeRateService.getByCurrency(currency); + return exchangeRateService.addCurrencyMappings(exchangeRate); + } + + public SupportedCodes getSupportedCodes() throws ExchangeRateException { + SupportedCodes supportedCodes = supportedCodesService.getSupportedCodes(); + return supportedCodesService.addCurrencyMappings(supportedCodes); + } + +} diff --git a/src/main/java/io/ljunggren/exchange/rate/api/model/SupportedCodes.java b/src/main/java/io/ljunggren/exchange/rate/api/model/SupportedCodes.java new file mode 100644 index 0000000..c2427f0 --- /dev/null +++ b/src/main/java/io/ljunggren/exchange/rate/api/model/SupportedCodes.java @@ -0,0 +1,28 @@ +package io.ljunggren.exchange.rate.api.model; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(Include.NON_NULL) +public class SupportedCodes { + + private String result; + private String documentation; + @JsonProperty("terms_of_use") + private String termsOfUse; + @JsonProperty("supported_codes") + private List> currencies; + +} diff --git a/src/main/java/io/ljunggren/exchange/rate/api/service/ExchangeRateService.java b/src/main/java/io/ljunggren/exchange/rate/api/service/ExchangeRateService.java index 277628f..0251511 100644 --- a/src/main/java/io/ljunggren/exchange/rate/api/service/ExchangeRateService.java +++ b/src/main/java/io/ljunggren/exchange/rate/api/service/ExchangeRateService.java @@ -1,39 +1,56 @@ -package io.ljunggren.exchange.rate.api.service; - -import org.apache.hc.client5.http.classic.methods.HttpGet; -import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; -import org.apache.hc.client5.http.impl.classic.HttpClients; -import org.apache.hc.core5.http.io.HttpClientResponseHandler; -import org.apache.hc.core5.http.io.entity.EntityUtils; - -import com.fasterxml.jackson.core.JsonProcessingException; - -import io.ljunggren.exchange.rate.api.exception.ExchangeRateException; -import io.ljunggren.exchange.rate.api.model.ExchangeRate; -import io.ljunggren.json.utils.JsonUtils; - -public class ExchangeRateService { - - private final String URI = "https://open.er-api.com/v6/latest/"; - - public ExchangeRate getByCurrency(String currency) throws ExchangeRateException { - HttpGet get = new HttpGet(URI + currency.toUpperCase()); - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpClientResponseHandler responseHandler = response -> { - return EntityUtils.toString(response.getEntity(), "UTF-8"); - }; - String json = httpClient.execute(get, responseHandler); - return parse(json, ExchangeRate.class); - } catch (Exception e) { - throw new ExchangeRateException(e); - } - } - - private T parse(String json, Class clazz) throws Exception { - try { - return JsonUtils.jsonToObject(json, clazz); - } catch (JsonProcessingException e) { - throw new Exception("Unable to parse response"); - } - } -} +package io.ljunggren.exchange.rate.api.service; + +import java.util.Map; + +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.HttpClientResponseHandler; +import org.apache.hc.core5.http.io.entity.EntityUtils; + +import io.ljunggren.exchange.rate.api.exception.ExchangeRateException; +import io.ljunggren.exchange.rate.api.model.ExchangeRate; + +public class ExchangeRateService extends ServiceBase { + + private final String URI = "https://open.er-api.com/v6/latest/"; + + public ExchangeRate getByCurrency(String currency) throws ExchangeRateException { + HttpGet get = new HttpGet(URI + currency.toUpperCase()); + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { + HttpClientResponseHandler responseHandler = response -> { + return EntityUtils.toString(response.getEntity(), "UTF-8"); + }; + String json = httpClient.execute(get, responseHandler); + return parse(json, ExchangeRate.class); + } catch (Exception e) { + throw new ExchangeRateException(e); + } + } + + public ExchangeRate addCurrencyMappings(ExchangeRate exchangeRate) { + if (exchangeRate == null) { + return null; + } + Map rates = exchangeRate.getRates(); + if (rates == null) { + return exchangeRate; + } + currencyMap.entrySet().stream().forEach(entry -> { + addCurrencyMap(rates, entry.getKey(), entry.getValue()); + }); + return exchangeRate; + } + + private void addCurrencyMap(Map rates, String from, String to) { + if (rates.get(to) != null) { + return; + } + Double value = rates.get(from); + if (value == null) { + return; + } + rates.put(to, value); + } + +} diff --git a/src/main/java/io/ljunggren/exchange/rate/api/service/ServiceBase.java b/src/main/java/io/ljunggren/exchange/rate/api/service/ServiceBase.java new file mode 100644 index 0000000..e44ce18 --- /dev/null +++ b/src/main/java/io/ljunggren/exchange/rate/api/service/ServiceBase.java @@ -0,0 +1,23 @@ +package io.ljunggren.exchange.rate.api.service; + +import java.util.Map; + +import com.fasterxml.jackson.core.JsonProcessingException; + +import io.ljunggren.json.utils.JsonUtils; + +public class ServiceBase { + + protected final Map currencyMap = Map.of( + "CNY", "RMB" + ); + + protected T parse(String json, Class clazz) throws Exception { + try { + return JsonUtils.jsonToObject(json, clazz); + } catch (JsonProcessingException e) { + throw new Exception("Unable to parse response"); + } + } + +} diff --git a/src/main/java/io/ljunggren/exchange/rate/api/service/SupportedCodesService.java b/src/main/java/io/ljunggren/exchange/rate/api/service/SupportedCodesService.java new file mode 100644 index 0000000..7148336 --- /dev/null +++ b/src/main/java/io/ljunggren/exchange/rate/api/service/SupportedCodesService.java @@ -0,0 +1,74 @@ +package io.ljunggren.exchange.rate.api.service; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.HttpClientResponseHandler; +import org.apache.hc.core5.http.io.entity.EntityUtils; + +import io.ljunggren.exchange.rate.api.exception.ExchangeRateException; +import io.ljunggren.exchange.rate.api.model.SupportedCodes; + +public class SupportedCodesService extends ServiceBase { + + private final String URI = "https://v6.exchangerate-api.com/v6/%s/codes"; + private String apiKey; + + public SupportedCodesService(String apiKey) { + this.apiKey = apiKey; + } + + public SupportedCodes getSupportedCodes() throws ExchangeRateException { + HttpGet get = new HttpGet(String.format(URI, apiKey)); + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { + HttpClientResponseHandler responseHandler = response -> { + return EntityUtils.toString(response.getEntity(), "UTF-8"); + }; + String json = httpClient.execute(get, responseHandler); + return parse(json, SupportedCodes.class); + } catch (Exception e) { + throw new ExchangeRateException(e); + } + } + + public SupportedCodes addCurrencyMappings(SupportedCodes supportedCodes) { + if (supportedCodes == null) { + return null; + } + List> currencies = supportedCodes.getCurrencies(); + if (currencies == null) { + return supportedCodes; + } + currencyMap.entrySet().stream().forEach(entry -> { + addSupportedCode(currencies, entry.getKey(), entry.getValue()); + }); + sort(currencies); + return supportedCodes; + } + + private void addSupportedCode(List> currencies, String from, String to) { + List fromCurrency = currencies.stream() + .filter(currency -> currency.get(0).equals(from)) + .findFirst() + .orElse(null); + if (fromCurrency == null) { + return; + } + List toCurrency = Arrays.asList(new String[] {to, fromCurrency.get(1)}); + currencies.add(toCurrency); + } + + private void sort(List> currencies) { + currencies.sort(new Comparator>() { + @Override + public int compare(List o1, List o2) { + return o1.get(0).compareTo(o2.get(0)); + } + }); + } + +} diff --git a/src/test/java/io/ljunggren/exchange/rate/api/model/ExchangeRateTest.java b/src/test/java/io/ljunggren/exchange/rate/api/model/ExchangeRateTest.java index b07694e..b59c18e 100644 --- a/src/test/java/io/ljunggren/exchange/rate/api/model/ExchangeRateTest.java +++ b/src/test/java/io/ljunggren/exchange/rate/api/model/ExchangeRateTest.java @@ -1,25 +1,25 @@ -package io.ljunggren.exchange.rate.api.model; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.io.IOException; - -import org.apache.commons.io.IOUtils; -import org.junit.jupiter.api.Test; - -import io.ljunggren.json.utils.JsonUtils; - -class ExchangeRateTest { - - private String readFromResources(String file) throws IOException { - return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); - } - - @Test - void deserializeTest() throws IOException { - String json = readFromResources("/exchangeRate.json"); - ExchangeRate exchangeRateConversion = JsonUtils.jsonToObject(json, ExchangeRate.class); - assertNotNull(exchangeRateConversion); - } - -} +package io.ljunggren.exchange.rate.api.model; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.io.IOException; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import io.ljunggren.json.utils.JsonUtils; + +class ExchangeRateTest { + + private String readFromResources(String file) throws IOException { + return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); + } + + @Test + void deserializeTest() throws IOException { + String json = readFromResources("/exchangeRate.json"); + ExchangeRate exchangeRate = JsonUtils.jsonToObject(json, ExchangeRate.class); + assertNotNull(exchangeRate); + } + +} diff --git a/src/test/java/io/ljunggren/exchange/rate/api/model/SupportedCodesTest.java b/src/test/java/io/ljunggren/exchange/rate/api/model/SupportedCodesTest.java new file mode 100644 index 0000000..6a8d07f --- /dev/null +++ b/src/test/java/io/ljunggren/exchange/rate/api/model/SupportedCodesTest.java @@ -0,0 +1,25 @@ +package io.ljunggren.exchange.rate.api.model; + +import static org.junit.jupiter.api.Assertions.*; + +import java.io.IOException; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import io.ljunggren.json.utils.JsonUtils; + +class SupportedCodesTest { + + private String readFromResources(String file) throws IOException { + return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); + } + + @Test + void deserializeTest() throws IOException { + String json = readFromResources("/supportedCodes.json"); + SupportedCodes exchangeRateConversion = JsonUtils.jsonToObject(json, SupportedCodes.class); + assertNotNull(exchangeRateConversion); + } + +} diff --git a/src/test/java/io/ljunggren/exchange/rate/api/service/ExchangeRateServiceTest.java b/src/test/java/io/ljunggren/exchange/rate/api/service/ExchangeRateServiceTest.java new file mode 100644 index 0000000..b26ce4e --- /dev/null +++ b/src/test/java/io/ljunggren/exchange/rate/api/service/ExchangeRateServiceTest.java @@ -0,0 +1,43 @@ +package io.ljunggren.exchange.rate.api.service; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.io.IOException; +import java.util.Map; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import io.ljunggren.exchange.rate.api.model.ExchangeRate; +import io.ljunggren.json.utils.JsonUtils; + +class ExchangeRateServiceTest { + + private ExchangeRateService exchangeRateService = new ExchangeRateService(); + + private String readFromResources(String file) throws IOException { + return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); + } + + @Test + void addCurrencyMappingTest() throws IOException { + String json = readFromResources("/exchangeRate.json"); + ExchangeRate exchangeRate = JsonUtils.jsonToObject(json, ExchangeRate.class); + exchangeRate = exchangeRateService.addCurrencyMappings(exchangeRate); + Map rates = exchangeRate.getRates(); + assertNotNull(rates.get("RMB")); + assertEquals(rates.get("CNY"), rates.get("RMB")); + } + + @Test + void addCurrenctMappingAlreadyExistsTest() throws IOException { + String json = readFromResources("/exchangeRate.json"); + ExchangeRate exchangeRate = JsonUtils.jsonToObject(json, ExchangeRate.class); + exchangeRate.getRates().put("RMB", 0.34); + int expected = exchangeRate.getRates().size(); + exchangeRate = exchangeRateService.addCurrencyMappings(exchangeRate); + assertEquals(expected, exchangeRate.getRates().size()); + } + +} diff --git a/src/test/java/io/ljunggren/exchange/rate/api/service/SupportedCodesServiceTest.java b/src/test/java/io/ljunggren/exchange/rate/api/service/SupportedCodesServiceTest.java new file mode 100644 index 0000000..64d5cf9 --- /dev/null +++ b/src/test/java/io/ljunggren/exchange/rate/api/service/SupportedCodesServiceTest.java @@ -0,0 +1,34 @@ +package io.ljunggren.exchange.rate.api.service; + +import static org.junit.jupiter.api.Assertions.*; + +import java.io.IOException; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import io.ljunggren.exchange.rate.api.model.SupportedCodes; +import io.ljunggren.json.utils.JsonUtils; + +class SupportedCodesServiceTest { + + private SupportedCodesService supportedCodesService = new SupportedCodesService(null); + + private String readFromResources(String file) throws IOException { + return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); + } + + @Test + void addCurrencyMappingsTest() throws IOException { + String json = readFromResources("/supportedCodes.json"); + SupportedCodes supportedCodes = JsonUtils.jsonToObject(json, SupportedCodes.class); + supportedCodes = supportedCodesService.addCurrencyMappings(supportedCodes); + List rmb = supportedCodes.getCurrencies().stream() + .filter(currency -> currency.get(0).equals("RMB")) + .findFirst() + .orElse(null); + assertNotNull(rmb); + } + +} diff --git a/src/test/resources/supportedCodes.json b/src/test/resources/supportedCodes.json new file mode 100644 index 0000000..7cbaa2b --- /dev/null +++ b/src/test/resources/supportedCodes.json @@ -0,0 +1,659 @@ +{ + "result": "success", + "documentation": "https://www.exchangerate-api.com/docs", + "terms_of_use": "https://www.exchangerate-api.com/terms", + "supported_codes": [ + [ + "AED", + "UAE Dirham" + ], + [ + "AFN", + "Afghan Afghani" + ], + [ + "ALL", + "Albanian Lek" + ], + [ + "AMD", + "Armenian Dram" + ], + [ + "ANG", + "Netherlands Antillian Guilder" + ], + [ + "AOA", + "Angolan Kwanza" + ], + [ + "ARS", + "Argentine Peso" + ], + [ + "AUD", + "Australian Dollar" + ], + [ + "AWG", + "Aruban Florin" + ], + [ + "AZN", + "Azerbaijani Manat" + ], + [ + "BAM", + "Bosnia and Herzegovina Convertible Mark" + ], + [ + "BBD", + "Barbados Dollar" + ], + [ + "BDT", + "Bangladeshi Taka" + ], + [ + "BGN", + "Bulgarian Lev" + ], + [ + "BHD", + "Bahraini Dinar" + ], + [ + "BIF", + "Burundian Franc" + ], + [ + "BMD", + "Bermudian Dollar" + ], + [ + "BND", + "Brunei Dollar" + ], + [ + "BOB", + "Bolivian Boliviano" + ], + [ + "BRL", + "Brazilian Real" + ], + [ + "BSD", + "Bahamian Dollar" + ], + [ + "BTN", + "Bhutanese Ngultrum" + ], + [ + "BWP", + "Botswana Pula" + ], + [ + "BYN", + "Belarusian Ruble" + ], + [ + "BZD", + "Belize Dollar" + ], + [ + "CAD", + "Canadian Dollar" + ], + [ + "CDF", + "Congolese Franc" + ], + [ + "CHF", + "Swiss Franc" + ], + [ + "CLP", + "Chilean Peso" + ], + [ + "CNY", + "Chinese Renminbi" + ], + [ + "COP", + "Colombian Peso" + ], + [ + "CRC", + "Costa Rican Colon" + ], + [ + "CUP", + "Cuban Peso" + ], + [ + "CVE", + "Cape Verdean Escudo" + ], + [ + "CZK", + "Czech Koruna" + ], + [ + "DJF", + "Djiboutian Franc" + ], + [ + "DKK", + "Danish Krone" + ], + [ + "DOP", + "Dominican Peso" + ], + [ + "DZD", + "Algerian Dinar" + ], + [ + "EGP", + "Egyptian Pound" + ], + [ + "ERN", + "Eritrean Nakfa" + ], + [ + "ETB", + "Ethiopian Birr" + ], + [ + "EUR", + "Euro" + ], + [ + "FJD", + "Fiji Dollar" + ], + [ + "FKP", + "Falkland Islands Pound" + ], + [ + "FOK", + "Faroese Króna" + ], + [ + "GBP", + "Pound Sterling" + ], + [ + "GEL", + "Georgian Lari" + ], + [ + "GGP", + "Guernsey Pound" + ], + [ + "GHS", + "Ghanaian Cedi" + ], + [ + "GIP", + "Gibraltar Pound" + ], + [ + "GMD", + "Gambian Dalasi" + ], + [ + "GNF", + "Guinean Franc" + ], + [ + "GTQ", + "Guatemalan Quetzal" + ], + [ + "GYD", + "Guyanese Dollar" + ], + [ + "HKD", + "Hong Kong Dollar" + ], + [ + "HNL", + "Honduran Lempira" + ], + [ + "HRK", + "Croatian Kuna" + ], + [ + "HTG", + "Haitian Gourde" + ], + [ + "HUF", + "Hungarian Forint" + ], + [ + "IDR", + "Indonesian Rupiah" + ], + [ + "ILS", + "Israeli New Shekel" + ], + [ + "IMP", + "Manx Pound" + ], + [ + "INR", + "Indian Rupee" + ], + [ + "IQD", + "Iraqi Dinar" + ], + [ + "IRR", + "Iranian Rial" + ], + [ + "ISK", + "Icelandic Króna" + ], + [ + "JEP", + "Jersey Pound" + ], + [ + "JMD", + "Jamaican Dollar" + ], + [ + "JOD", + "Jordanian Dinar" + ], + [ + "JPY", + "Japanese Yen" + ], + [ + "KES", + "Kenyan Shilling" + ], + [ + "KGS", + "Kyrgyzstani Som" + ], + [ + "KHR", + "Cambodian Riel" + ], + [ + "KID", + "Kiribati Dollar" + ], + [ + "KMF", + "Comorian Franc" + ], + [ + "KRW", + "South Korean Won" + ], + [ + "KWD", + "Kuwaiti Dinar" + ], + [ + "KYD", + "Cayman Islands Dollar" + ], + [ + "KZT", + "Kazakhstani Tenge" + ], + [ + "LAK", + "Lao Kip" + ], + [ + "LBP", + "Lebanese Pound" + ], + [ + "LKR", + "Sri Lanka Rupee" + ], + [ + "LRD", + "Liberian Dollar" + ], + [ + "LSL", + "Lesotho Loti" + ], + [ + "LYD", + "Libyan Dinar" + ], + [ + "MAD", + "Moroccan Dirham" + ], + [ + "MDL", + "Moldovan Leu" + ], + [ + "MGA", + "Malagasy Ariary" + ], + [ + "MKD", + "Macedonian Denar" + ], + [ + "MMK", + "Burmese Kyat" + ], + [ + "MNT", + "Mongolian Tögrög" + ], + [ + "MOP", + "Macanese Pataca" + ], + [ + "MRU", + "Mauritanian Ouguiya" + ], + [ + "MUR", + "Mauritian Rupee" + ], + [ + "MVR", + "Maldivian Rufiyaa" + ], + [ + "MWK", + "Malawian Kwacha" + ], + [ + "MXN", + "Mexican Peso" + ], + [ + "MYR", + "Malaysian Ringgit" + ], + [ + "MZN", + "Mozambican Metical" + ], + [ + "NAD", + "Namibian Dollar" + ], + [ + "NGN", + "Nigerian Naira" + ], + [ + "NIO", + "Nicaraguan Córdoba" + ], + [ + "NOK", + "Norwegian Krone" + ], + [ + "NPR", + "Nepalese Rupee" + ], + [ + "NZD", + "New Zealand Dollar" + ], + [ + "OMR", + "Omani Rial" + ], + [ + "PAB", + "Panamanian Balboa" + ], + [ + "PEN", + "Peruvian Sol" + ], + [ + "PGK", + "Papua New Guinean Kina" + ], + [ + "PHP", + "Philippine Peso" + ], + [ + "PKR", + "Pakistani Rupee" + ], + [ + "PLN", + "Polish Złoty" + ], + [ + "PYG", + "Paraguayan Guaraní" + ], + [ + "QAR", + "Qatari Riyal" + ], + [ + "RON", + "Romanian Leu" + ], + [ + "RSD", + "Serbian Dinar" + ], + [ + "RUB", + "Russian Ruble" + ], + [ + "RWF", + "Rwandan Franc" + ], + [ + "SAR", + "Saudi Riyal" + ], + [ + "SBD", + "Solomon Islands Dollar" + ], + [ + "SCR", + "Seychellois Rupee" + ], + [ + "SDG", + "Sudanese Pound" + ], + [ + "SEK", + "Swedish Krona" + ], + [ + "SGD", + "Singapore Dollar" + ], + [ + "SHP", + "Saint Helena Pound" + ], + [ + "SLE", + "Sierra Leonean Leone" + ], + [ + "SLL", + "Sierra Leonean Leone" + ], + [ + "SOS", + "Somali Shilling" + ], + [ + "SRD", + "Surinamese Dollar" + ], + [ + "SSP", + "South Sudanese Pound" + ], + [ + "STN", + "São Tomé and Príncipe Dobra" + ], + [ + "SYP", + "Syrian Pound" + ], + [ + "SZL", + "Eswatini Lilangeni" + ], + [ + "THB", + "Thai Baht" + ], + [ + "TJS", + "Tajikistani Somoni" + ], + [ + "TMT", + "Turkmenistan Manat" + ], + [ + "TND", + "Tunisian Dinar" + ], + [ + "TOP", + "Tongan Paʻanga" + ], + [ + "TRY", + "Turkish Lira" + ], + [ + "TTD", + "Trinidad and Tobago Dollar" + ], + [ + "TVD", + "Tuvaluan Dollar" + ], + [ + "TWD", + "New Taiwan Dollar" + ], + [ + "TZS", + "Tanzanian Shilling" + ], + [ + "UAH", + "Ukrainian Hryvnia" + ], + [ + "UGX", + "Ugandan Shilling" + ], + [ + "USD", + "United States Dollar" + ], + [ + "UYU", + "Uruguayan Peso" + ], + [ + "UZS", + "Uzbekistani So'm" + ], + [ + "VES", + "Venezuelan Bolívar Soberano" + ], + [ + "VND", + "Vietnamese Đồng" + ], + [ + "VUV", + "Vanuatu Vatu" + ], + [ + "WST", + "Samoan Tālā" + ], + [ + "XAF", + "Central African CFA Franc" + ], + [ + "XCD", + "East Caribbean Dollar" + ], + [ + "XCG", + "Caribbean Guilder" + ], + [ + "XDR", + "Special Drawing Rights" + ], + [ + "XOF", + "West African CFA franc" + ], + [ + "XPF", + "CFP Franc" + ], + [ + "YER", + "Yemeni Rial" + ], + [ + "ZAR", + "South African Rand" + ], + [ + "ZMW", + "Zambian Kwacha" + ], + [ + "ZWL", + "Zimbabwean Dollar" + ] + ] +} \ No newline at end of file