A Typescript designed project to manage benefit cards among companies and employees
Valex simulates an API that manages a benefit card, generally made available by companies to their employees.
- Get the card balance and transactions
- Create cards
- Activate / Block / Unlock a card
- Recharge a card
- Make card payments with online payment option
GET /card/balance/:number
Params | Type | Description |
---|---|---|
number |
integer |
Required. Card number |
POST /cards/create
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 |
{
"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
POST /cards/activate
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
POST /cards/block
Body | Type | Description |
---|---|---|
number |
string |
Required. number of the card |
password |
string |
Required. card password |
POST /cards/unblock
Body | Type | Description |
---|---|---|
number |
string |
Required. number of the card |
password |
string |
Required. card password |
POST /recharge
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 |
POST /buying
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
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
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
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.
- 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.