Skip to content

Tutuezin/projeto18-valex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/:cardId

Request:

Params Type Description
cardId integer Required. card Id

Create a card

POST /card/create

Request:

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

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

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


Response:

{
	"number": "1111 1111 1111 1111",
	"name": "NAME N NAME",
	"CVC": "111",
	"expiration": "01/27",
	"type": "card type",
}

number has no defined format

Activate a card

PUT /card/activate/:cardId

Request:

Params Type Description
cardId integer Required. card Id

Body Type Description
securityCode string Required. card cvv
password string Required. card password

Password length: 4

Password pattern: only numbers

Cvc max length: 3

Block a card

PUT /card/block/:cardId

Request:

Params Type Description
cardId integer Required. card Id

Body Type Description
password string Required. card password

Unlock a card

PUT /card/unlock/:cardId

Request:

Params Type Description
cardId integer Required. card Id
Body Type Description
password string Required. card password

Recharge a card

POST /card/recharge/:cardId

Request:

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

Params Type Description
cardId integer Required. card Id

Body Type Description
amount integer Required. recharge amount

Card payments

POST /card/payment/:cardId/:businessId

Request:

Params Type Description
cardId integer Required. card Id
businessId integer Required. business Id

Body Type Description
password string Required. card password
amount integer Required. payment amount

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

CRYPTR_SECRET_KEY = any string


Run Locally

Clone the project

  git clone https://github.com/tutuezin/projeto18-valex

Go to the project directory

  cd projeto18-valex/

Install dependencies

  npm install

Create database

  cd database
  bash ./create-database
  cd ../

Start the server

  npm start

Lessons Learned

In this project I learned a lot about how to structure an API with TypeScript


Acknowledgements


Authors

  • Arthur Alcantara is a junior full stack developer and student of Information Systems at UFPE and Driven Education.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published