Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Veri5 API Project - MVP

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.

Requirements

To run this project, you need:

  • Java 17+ (preferably with OpenJDK)
  • Maven for building the project
  • Spring Boot dependencies

Running the Project

  1. Clone the Repository

    git clone <your-repository-url>
    cd veri5-api
  2. 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 .jar file.

  3. 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 .jar file directly:

    java -jar target/veri5-api-<version>.jar

    The application will start, and the APIs will be accessible at http://localhost:8080.

Accessing the APIs

1. Currency API: Check if a Currency is Accepted in a Country

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&currencyCode=USD

  • cURL Command:

    curl -X GET "http://localhost:8080/api/currency/isAccepted?countryCode=US&currencyCode=USD"

    This will return a true or false response indicating whether the given currency is accepted in the specified country.

2. IBAN Validation API: Validate IBAN and Get Details

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.

Accessing the APIs via Swagger UI

To interact with the APIs using Swagger UI (a web interface for testing APIs):

  1. Start the application using mvn spring-boot:run or the java -jar command.

  2. Open your browser and navigate to the Swagger UI URL:

    • URL: http://localhost:8080/swagger-ui.html

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.

Example Response Formats

Currency API Response:

{
  "isAccepted": true
}

IBAN Validation API Response:

{
  "iban": "GB82WEST12345698765432",
  "country": "GB",
  "bank_code": "WEST",
  "branch_code": null,
  "account_number": "12345698765432",
  "bban": "12345698765432",
  "isValid": true
}

Error Handling

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"
}

Common Issues

  1. 404 Not Found: Ensure the application is running on the correct port (http://localhost:8080).
  2. 400 Bad Request: Missing required query parameters (iban, countryCode, currencyCode).

Additional Notes

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.

About

Trust layer for Digital Payments

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages