Skip to content

helioLJ/credit-card-validation-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Credit Card Validation Task Solution

This repository contains the back-end solution for the Credit Card Validation task.

Imgur

Prerequisites

Before running the application and tests, ensure that you have the following installed on your system:

  • Java Development Kit (JDK)
  • Your preferred integrated development environment (IDE) for easier code navigation and execution (e.g., IntelliJ IDEA, Eclipse)

How to Run the Application

  1. Clone this Git repository to your local machine using the following command:
git clone https://github.com/helioLJ/credit-card-validation-api
  1. Open the project in your preferred IDE.

  2. Build the project using Gradle by running the following command in the project's root directory:

./gradlew build
  1. Start the Spring Boot application by running the following command:
./gradlew bootRun

This will start the application, and it will be accessible at http://localhost:8080.

How to Run the Tests

You can run the unit tests for the application to verify its functionality. To do this, follow these steps:

  1. Ensure that the application is not currently running.

  2. Open a terminal window and navigate to the project's root directory.

  3. Run the following Gradle command to execute the tests:

./gradlew cleanTest test

This command will run all the tests in the project, and you will see the test results in the terminal.

API Usage

The application exposes a simple API endpoint for credit card validation. You can send POST requests to http://localhost:8080/api/validate with a JSON body containing credit card details. Here's an example request:

{
"cardNumber": "4916011117218331",
"expiryDate": "02/27",
"cvv": "279"
}

The API will respond with either "Success!" if the credit card information is valid or "Invalid Credit Card information." if it's not.

Additional Information

The solution uses Spring Boot for the backend implementation. The front-end solution is right here The project structure follows standard Spring Boot conventions. Unit tests are provided to ensure the correctness of the implemented logic. Feel free to explore and modify the code as needed.

About

Credit Card Validation API using Java Spring Boot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages