Code Monkey home page Code Monkey logo

mintyn-assessment's Introduction

Author

Name: Ikechukwu Michael, Email: [email protected]

Introduction🖖

My solution to minTYN technical assessment.

This Card Verification Service is a Spring Boot microservice designed to provide customers with detailed information about their cards. The service aims to offer a seamless experience by verifying the validity, scheme (VISA, MASTERCARD, or AMEX), and associated bank for a given card number. Additionally, the service maintains statistics on the number of verification requests made by users.

Specification

  • Users are able to sign up using their email and password.
  • Users can log in using a username and password.
  • Upon successful profile creation, users are able to retrieve insights for their card.
  • Users are also able to retrieve statistical insights for verifiable cards.

Step One - Tools and Technologies used 🎼

  • Spring Boot(V2.7.3)
  • Spring Data JPA
  • Lombok Library
  • JDK 18
  • Embedded Tomcat
  • Mysql Database(Mysql Workbench)
  • Maven
  • Java IDE (IntelliJ)
  • Postman Client

Step Two - Steps to Run the project Locally ⚙️

MySQL Workbench was used to run the database locally. Navigate to the project application.yml file and modify the database credential per your database server requirement such as username and password

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/cardInsight?createDatabaseIfNotExist=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    username: #Database-username
    password: #Database-password

Installation

  • Clone this repo:
git clone https://github.com/michaelik/meCash-TC.git
  • Navigate to the root directory of the project.
  • Build the application
./mvnw clean install
  • Run the application
./mvnw spring-boot:run

Usage 🧨

REST APIs For Card Insight Resource

Host: http://localhost:8080

HTTP METHOD ROUTE STATUS CODE DESCRIPTION
POST /api/auth/register 201 Create new user
POST /api/auth/login 200 Login into your newly created account
GET /api/v1/card-scheme/user-detail/{id} 200 Read user detail
GET /api/v1/card-scheme/verify/{bin} 200 Get issuer identification number detail
GET /api/v1/card-scheme/stats?{start}&{limit} 200 Get issuer identification number statistics

The Client should be able to:

SignUp

The payload will have the following fields:

  • name:
  • email:
  • password
  • age:
  • gender:
  • accountCurrency:

Request

curl -X POST http://localhost:8080/api/auth/register \
-H 'Content-type: application/json' \
-d '{
    "name": "Ikechukwu Michael",
    "email": "[email protected]",
    "password": "12345",
    "age": 20,
    "gender": "M"
}'

SignIn

The payload will have the following field:

  • username:
  • password:

Request

curl -X POST http://localhost:8080/api/auth/login \
-H 'Content-type: application/json' \
-d '{
    "username": "[email protected]",
    "password": "12345"
}'

Response

{
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJzY29wZXMiOlsiUk9MRV9VU0VSIl0sInN1YiI6Im1pa2Vpa2VjaGkzQGdtYWlsLmNvbSIsImlhdCI6MTY5MjIwOTQ2MiwiZXhwIjoxNjkzNTA1NDYyfQ.tWbASUsAzxtOjVCGWB9_dNn6qmm35IATzoNT9QQmmUY",
  "id": 1,
  "name": "michael ikechukwu",
  "email": "[email protected]",
  "gender": "M",
  "age": 20,
  "roles": [
    "ROLE_USER"
  ],
  "username": "[email protected]"
}

Read Account Detail

Request

curl -X GET http://localhost:8080/api/v1/card-scheme/user-detail/1 \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzY29wZXMiOlsiUk9MRV9VU0VSIl0sInN1YiI6Im1pa2Vpa2VjaGkzQGdtYWlsLmNvbSIsImlhdCI6MTY5MjIwOTQ2MiwiZXhwIjoxNjkzNTA1NDYyfQ.tWbASUsAzxtOjVCGWB9_dNn6qmm35IATzoNT9QQmmUY' \

Response

{
  "id": 1,
  "name": "michael ikechukwu",
  "email": "[email protected]",
  "age": 20,
  "gender": "M"
}

Verify Bank Identification Number

Request

curl -X GET http://localhost:8080/api/v1/card-scheme/verify/53992370
-H 'Content-type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzY29wZXMiOlsiUk9MRV9VU0VSIl0sInN1YiI6Im1pa2Vpa2VjaGkzQGdtYWlsLmNvbSIsImlhdCI6MTY5MjIwOTQ2MiwiZXhwIjoxNjkzNTA1NDYyfQ.tWbASUsAzxtOjVCGWB9_dNn6qmm35IATzoNT9QQmmUY' \

Response

{
  "success": true,
  "payload": {
    "scheme": "mastercard",
    "type": "debit",
    "bank": "FIRST"
  }
}

Read Card Statistics

Request

curl -X GET http://localhost:8080/api/v1/card-scheme/stats?1&2
-H 'Content-type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzY29wZXMiOlsiUk9MRV9VU0VSIl0sInN1YiI6Im1pa2Vpa2VjaGkzQGdtYWlsLmNvbSIsImlhdCI6MTY5MjIwOTQ2MiwiZXhwIjoxNjkzNTA1NDYyfQ.tWbASUsAzxtOjVCGWB9_dNn6qmm35IATzoNT9QQmmUY' \

Response

{
  "success": true,
  "start": 1,
  "limit": 2,
  "size": 1,
  "payload": {
    "53992370": "1"
  }
}

mintyn-assessment's People

Contributors

michaelik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.