Trust layer for Digital Payments
This project provides two APIs:
- Currency API: Check if a currency is accepted in a specific country.
- IBAN Validation API: Validate IBAN (International Bank Account Number) and extract details.
To run this project, you need:
- Java 17+ (preferably with OpenJDK)
- Maven for building the project
- Spring Boot dependencies
-
Clone the Repository
git clone <your-repository-url> cd veri5-api
-
Build the Project If you have Maven installed, you can build the project using the following command:
mvn clean install
This will compile the project and package it into a runnable
.jarfile. -
Run the Project After the build is successful, you can run the project using the following command:
mvn spring-boot:run
This will start the Spring Boot application on the default port (8080).
Alternatively, you can also run the
.jarfile directly:java -jar target/veri5-api-<version>.jar
The application will start, and the APIs will be accessible at
http://localhost:8080.
API Endpoint
- URL:
GET /api/currency/isAccepted
Query Parameters:
countryCode(required): The two-letter country code (ISO 3166-1 alpha-2).currencyCode(required): The ISO 4217 currency code.
Example:
-
URL:
http://localhost:8080/api/currency/isAccepted?countryCode=US¤cyCode=USD -
cURL Command:
curl -X GET "http://localhost:8080/api/currency/isAccepted?countryCode=US¤cyCode=USD"This will return a
trueorfalseresponse indicating whether the given currency is accepted in the specified country.
API Endpoint
- URL:
GET /api/iban/validate
Query Parameters:
iban(required): The IBAN string to be validated.countryCode(optional): The two-letter country code (ISO 3166-1 alpha-2) to validate against. If not provided, the IBAN’s country code will be inferred.
Example:
-
URL:
http://localhost:8080/api/iban/validate?iban=GB82WEST12345698765432 -
cURL Command:
curl -X GET "http://localhost:8080/api/iban/validate?iban=GB82WEST12345698765432"This will return a JSON response with the validation results and IBAN details.
To interact with the APIs using Swagger UI (a web interface for testing APIs):
-
Start the application using
mvn spring-boot:runor thejava -jarcommand. -
Open your browser and navigate to the Swagger UI URL:
- URL:
http://localhost:8080/swagger-ui.html
- URL:
From the Swagger UI, you can:
- View and interact with the Currency API and IBAN Validation API.
- Execute the APIs directly from the browser interface.
{
"isAccepted": true
}{
"iban": "GB82WEST12345698765432",
"country": "GB",
"bank_code": "WEST",
"branch_code": null,
"account_number": "12345698765432",
"bban": "12345698765432",
"isValid": true
}If an error occurs (e.g., invalid IBAN format or unsupported country code), the API will return an appropriate HTTP status code and message.
Example error response for IBAN validation:
{
"error": "Invalid IBAN format: GB82WEST12345698765432"
}- 404 Not Found: Ensure the application is running on the correct port (http://localhost:8080).
- 400 Bad Request: Missing required query parameters (iban, countryCode, currencyCode).
The APIs return data in JSON format. Ensure your system has internet access if the application requires network-based services. You can extend the functionality by adding new endpoints or integrating external services for more advanced IBAN validation.