Credit card processing system allows adding new credit card to account and fetch existing credit cards by accessing Restful API's.
The credit card processing system has been built upon Spring Boot with support of Embedded MongoDB, Spring REST Docs and AsciiDoctor to provide quick access on resources.
This application provides below endpoints
[POST] /api/v1/cards : Add new credit card
[GET] /api/v1/cards : Fetch existing cards
Full details for above endpoints are documented here
- API will except JSON formatted request only.
- Credit card number will be checked based on Luhn10 algorithm
- Card number will be validated for number
Here we have used both type of validation (Custom and From Lib)
- Basic validation provided by libraries like NotNull etc. ( To prove less code & more config)
- Custom Implementation for card validation (As asked in Assignment, Using Luh10 Algorithm, Implementation of Luhn10 can be found here)
NOTE: Credit card number will be validated by our Luhn10 implementation which will be handle by our own created custom validation annotation applied on card->number field .
Credit card processing application provides below types of documentation
- Automatically generated API documentation (To see follow credit-card-processing/target/generated-docs directory)
- Swagger Open API specification
For more details refer how to test section below
See credit-card-processing.pdf
See credit-card-processing-swagger-doc.pdf
class diagrams can be accessed from class-diagram folder here
* Database: cards
* Collection Name: cards
* url: localhost
* port: 27057
This application can be test based on availability of below tools & software.
Java version 8
Development IDE
REST API Testing Tools (like postman)
Maven version 3 or later (Good to have)
Source code of credit card application can be download from here
Zip file of full source code can be downloaded from here
git clone https://github.com/rahulmzn/credit-card-processing.git
NOTE: If Maven software not installed (or configured) on system
NOTE: To run any of below commands system command prompt should point inside downloaded application folder
e.g cd credit-card-processing
./mvnw clean install
./mvnw.cmd clean install
./mvnw package
./mvnw.cmd package
To run credit card application execute below steps
./mvnw spring-boot:run
./mvnw.cmd spring-boot:run
Application will be by default published on port 8080 at localhost,
NOTE: This also can be customised by changing port value for server.port property application.properties. Once port has been changed, do update below endpoint on newly configured port
After deployment of application Test Restful API link can be followed to test API's.
Access Test API : http://localhost:8080/swagger-ui-custom.html
NOTE: Published by default on environment: http://localhost:8080/
After deployment of application Test Restful API link can be followed to test API's.
: curl --location --request POST 'http://localhost:8080/api/v1/cards' --header 'Content-Type: application/json' --data-raw '{ "brand": "VISA", "type": "testing type", "currency": "GBP", "limit": "1000", "funding": "", "number": "4012888888881881", "country": "GB", "name": "Rahul Kumr" }'
: curl --header 'Content-Type: application/json' 'http://localhost:8080/api/v1/cards'
All the reports will be generated under credit-card-processing/target
after running maven scripts as given above
NOTE: If Maven software pre-installed on system.
mvn clean install
mvn package
Find generated application packaged jar file inside credit-card-processing/target/credit-card-processing-0.0.1-SNAPSHOT.jar
NOTE: Move terminal to target folder path using cd commend if mvn install command has been executed.
java -jar credit-card-processing-0.0.1-SNAPSHOT.jar