An application for performing currency exchange rate conversions. The app allows users to input the source and target currencies, enter an amount, and trigger the conversion from the source to the target currency. The app displays a list of conversions and current exchange rates for the selected source currency.
- Business Requirements
- Functional Requirements
- API Endpoints
- Sequence Diagram
- Example API Responses
- Technologies Used
- Partner API
- Configuration
- How to Run
- Future Goals
- License
- Currency Conversion: Users should be able to convert between different currencies using up-to-date exchange rates.
- Currency Symbol Display: The application should provide a list of available currency symbols for users to choose from.
- Accurate Conversion Rates: Conversion rates must reflect real-time rates from a reliable source.
- Error Handling: Proper error messages should be displayed to users for invalid requests or server errors.
- User Privacy: The application should handle user data securely and not store sensitive information unnecessarily.
-
GET /symbol Endpoint:
- Returns a list of 3-character currency codes available for exchange.
-
GET /convert Endpoint:
- Accepts parameters
from
,to
, andamount
. - Returns the conversion rate from
from
currency toto
currency based onamount
. - Provides the converted amount (
targetAmount
) and the original amount (sourceAmount
).
- Accepts parameters
API Base URL: http://localhost:8080
GET /symbol
: Returns a list of 3-character currency codes available for exchange.GET /convert?from=EUR&to=INR&amount=100
: Returns the conversion rate.from
andto
should be the 3-character currency codes available for exchange.amount
is the amount on which conversion information will be fetched and displayed.
The following sequence diagram illustrates the interactions between the Client, Server Application, and External API for fetching currency symbols and performing conversions:
GET /symbol HTTP/1.1
User-Agent: PostmanRuntime/7.30.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 44636757-4908-42d7-90de-f9e6810a3ac3
Host: localhost:8080
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Fri, 30 Dec 2022 04:31:22 GMT
Keep-Alive: timeout=60
Connection: keep-alive
["FJD","MXN","STD","SCR","CDF","BBD","GTQ","CLP","HNL","UGX","ZAR","TND","STN","CUC","BSD","SLL","SDG","IQD","CUP","GMD","TWD","RSD","DOP","KMF","MYR","FKP","XOF","GEL","BTC","UYU","MAD","CVE","TOP","AZN","OMR","PGK","KES","SEK","CNH","BTN","UAH","GNF","ERN","MZN","SVC","ARS","QAR","IRR","XPD","CNY","THB","UZS","XPF","MRU","BDT","LYD","BMD","KWD","PHP","XPT","RUB","PYG","ISK","JMD","COP","MKD","USD","DZD","PAB","GGP","SGD","ETB","JEP","KGS","SOS","VUV","LAK","BND","XAF","LRD","XAG","CHF","HRK","ALL","DJF","VES","ZMW","TZS","VND","XAU","AUD","ILS","GHS","GYD","KPW","BOB","KHR","MDL","IDR","KYD","AMD","BWP","SHP","TRY","LBP","TJS","JOD","AED","HKD","RWF","EUR","LSL","DKK","CAD","BGN","MMK","MUR","NOK","SYP","IMP","ZWL","GIP","RON","LKR","NGN","CRC","CZK","PKR","XCD","ANG","HTG","BHD","KZT","SRD","SZL","SAR","TTD","YER","MVR","AFN","INR","AWG","KRW","NPR","JPY","MNT","AOA","PLN","GBP","SBD","BYN","HUF","BIF","MWK","MGA","XDR","BZD","BAM","EGP","MOP","NAD","SSP","NIO","PEN","NZD","WST","TMT","CLF","BRL"]
GET /convert?from=EUR&to=INR&amount=100 HTTP/1.1
User-Agent: PostmanRuntime/7.30.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 9c6404df-8d1f-47f0-93ca-ca1b599320a4
Host: localhost:8080
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Fri, 30 Dec 2022 04:32:03 GMT
Keep-Alive: timeout=60
Connection: keep-alive
{"targetCurrency":"INR","sourceCurrency":"EUR","targetAmount":"8824.309774","sourceAmount":"100"}
- Java 1.8.0_332
- Gradle 4.10.x
- Spring Boot 2.5.2
- JUnit 4.13.2
- exchangerate.host — Partner APIs
Exchange rates API is a simple and lightweight free service for current and historical foreign exchange rates & crypto exchange rates.
Update partner API configuration in src/main/resources/application.properties
:
currency.baseUrl=https://api.exchangerate.host/
currency.path.symbol=latest
currency.path.convert=convert
currency.accessKey=<API_Key>
-
Start the Application:
gradle bootRun
The server will be available at
http://localhost:8080
. -
Run Tests:
gradle test
- Reorganize conversion API
GET /convert
- Add validation for
GET /convert
- Improve unit test cases
- Upgrade Gradle, Spring Boot, and JUnit versions
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Amburi Roy. For any inquiries, please contact via LinkedIn.