/BVN_Validator

An API to be consumed by a web service for BVN validation...with MongoDB

Primary LanguageJava

BVN VALIDATION

This is a service to validate BVNs, preconfigured in memory.

PREREQUISITES

  1. MongoDb must be running locally
  2. Request and response objects are stored in a MongoDb NoSql store, based on the configured properties.

Technologies

  • Java
  • Maven
  • Springboot
  • JUnit
  • MongoDB

Requirements

You need the following to build and run the application:

How to run

step 1 - clone project with from here

git clone https://github.com/NfoTECH/Seamfix_Assessment.git

step 2 - move into the project directory

cd seamfix_assessment/

step 3 - Generate the .jar file

mvn clean install
OR
./mvnw clean install

step 4 - run the project

java -jar seamfix_assessment-0.0.1-SNAPSHOT.jar

NOTE :

  • The application can also be run as a standalone application, by running as a springboot project with the "play" but on IntelliJ

Testing the API endpoint with various bvn inputs


  • BVN 12345678901

Test Cases to Consider

This is an image

Endpoint

http://localhost:8080/bv-service/svalidate/wrapper

1. Valid BVN

curl --location --request POST 'http://localhost:8080/bv-service/svalidate/wrapper' \
--header 'Content-Type: application/json' \
--data-raw '{
    "bvn" : "12345678901"
}'

Response

{
    "message": "Success",
    "code": 0,
    "bvn": "12345678901",
    "imageDetail": "https://res.cloudinary.com/olamire/image/upload/v1590000000/olamire.jpg",
    "basicDetail": "Rm9ydHVuYXRlIE53YWNodWt3dSBNIDEyMzQ1Njc4OTAx"
}

This is an image

2. Invalid BVN

curl --location --request POST 'http://localhost:8080/bv-service/svalidate/wrapper' \
--header 'Content-Type: application/json' \
--data-raw '{
    "bvn" : "123456789011"
}'

Response

{
    "message": " “The searched BVN does not exist",
    "bvn": "123456789011",
    "code": 1,
    "imageDetail": null,
    "basicDetail": null
}

This is an image

3. BVN with invalid length

curl --location --request POST 'http://localhost:8080/bv-service/svalidate/wrapper' \
--header 'Content-Type: application/json' \
--data-raw '{
    "bvn" : "123456789"
}'

Response

{
    "message": " “The searched BVN is invalid",
    "bvn": "123456789",
    "code": 1,
    "imageDetail": null,
    "basicDetail": null
}

This is an image

4. BVN with invalid characters

curl --location --request POST 'http://localhost:8080/bv-service/svalidate/wrapper' \
--header 'Content-Type: application/json' \
--data-raw '{
    "bvn" : "A1234567891"
}'

Response

{
   "message": "The searched BVN is invalid",
   "bvn": "A1234567891",
   "code": 400,
   "imageDetail": null,
   "basicDetail": null
}

This is an image

5. Empty BVN

curl --location --request POST 'http://localhost:8080/bv-service/svalidate/wrapper' \
--header 'Content-Type: application/json' \
--data-raw '{
    
}'

Response

{
   "message": "One or more of your request parameters failed validation. Please retry",
   "bvn": null,
   "code": 400,
   "imageDetail": null,
   "basicDetail": null
}

This is an image

6. MongoDB test data

This is an image