Git Product home page Git Product logo

projeto-18---valex's Introduction

projeto18-valex

A Typescript designed project to manage benefit cards among companies and employees

Valex

Built With


Description

Valex simulates an API that manages a benefit card, generally made available by companies to their employees.


Features

  • Get the card balance and transactions
  • Create cards
  • Activate / Block / Unlock a card
  • Recharge a card
  • Make card payments with online payment option

API Reference

Get card balance

GET /card/balance/:number

Request:

Params Type Description
number integer Required. Card number

Create a card

POST /cards/create

Request:

Body Type Description
employeeId integer Required. user Id
type string Required. type of card benefit

Valid types: [groceries, restaurant, transport, education, health]

Headers Type Description
x-api-key string Required. api key


Response:

{
	"number": "12345678",
	"cardholderName": "NAME N NAME",
	"securityCode": "111",
	"expirationDate": "01/27",
	"isVirtual": false,
	"isBlocked": false,
	"type": "card type",
	"cvc": "111"
}

number was defined as 8 randown numbers

Activate a card

POST /cards/activate

Request:

Body Type Description
number string Required. number of the card
password string Required. card password
securityCode string Required. card cvv

Password length: 4

Password pattern: only numbers

Secutiry code length: 3

Block a card

POST /cards/block

Request:

Body Type Description
number string Required. number of the card
password string Required. card password

Unlock a card

POST /cards/unblock

Request:

Body Type Description
number string Required. number of the card
password string Required. card password

Recharge a card

POST /recharge

Request:

Headers Type Description
x-api-key string Required. api key

Body Type Description
number string Required. number of the card
amount integer Required. recharge amount

Card payments

POST /buying

Request:

Body Type Description
number string Required. number of the card
businessName string Required. name of the business
password string Required. card password
amount integer Required. payment amount

By the DB rules, the businessName is a unique string

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

DATABASE_URL = postgres://UserName:Password@Hostname:5432/DatabaseName

PORT = number #recommended:5000


Run Locally

Clone the project

  git clone https://github.com/IgorFontenell/Projeto-18---Valex.git

Go to the project directory

  cd projeto18-valex/

Install dependencies

  npm install

Create database

  cd src/db/dbConfig
  bash ./create-database
  cd ../../..

Start the server

  npm run start

Lessons Learned

In this project I learned a lot about how to structure an API with TypeScript as how to make a project following the Layered Architecture.


Acknowledgements


Authors

  • Igor Fontenelle is a student at Driven Education putting a lot of effort into the programing world. He is looking for the transiction of the engineering world to be a Dev.

projeto-18---valex's People

Contributors

igorfontenell avatar

Stargazers

Hector Antônio Batista dos Santos 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.