API to get currency quotation on determinated date.
The data source used will be the Brazilian central bank CSV file available at: http://www4.bcb.gov.br/pec/taxas/batch/cotacaomoedas.asp?id=txtodas
It was created the function currencyQuotation that return the quotation of "from" to "to"
public BigDecimal currencyQuotation(String from, String to, Number value, String quotationDate);
from: String with the currency name (example "USD") you want to convert;
to: String with the currency name (example "EUR") you want to see the result;
value: The value that should be converted. The currency of this value will be expressed in the “from” parameter;
quotationDate: A date as String in the format “dd/MM/yyyy”;
-
You shall not work with non-native classes / libraries;
-
If the from or to parameters are not valid, an exception must be thrown;
-
If the value is smaller than zero, an exception must be thrown;
-
For non-working days (Saturday and Sunday, ignoring holidays) takes the quotation from the immediately preceding business day. If the quotation of the previous day is not available, an exception must be thrown;
-
If the quotation date is not available, an exception must be thrown;
-
The return value should be rounded to two decimal places.
-
You must convert the currency through rate "Taxa Compra".
mvn test