Benefit cards API, create and store card data and log transactions

Overview

Valex πŸ’³

Benefit cards for companies and employees!

πŸ’» Tech used

Overview

An API to store benefit cards from companies to employees and log transactions.

πŸ› οΈ Installation

Make sure you have the following tools installed before you begin:

Not needed but recommended: VSCode

Use a terminal interface such as bash or zsh, and enter the following:

#download
gh repo clone fMagVen/Valex

#access the folder you downloaded it to
cd valex

#install dependencies
npm i

#install the db
bash /database/create-database

The app will run locally and you must configure a .env file with a port of your choosing. The default one is 5000.

βš™οΈ Running

#you can run the server with
npm run dev

In another terminal instance, run the db

#you can start the db running the script 
bash /database/connect-database

#in case you need to reset the data, run
bash /database/destroy-database
#then rerun the create-database script

πŸ“œ Documentation

All requests are HTTP based

POST /cards/new

Add new card to employee. Send header 'x-api-key' with value of the desined API Key of the company and body JSON with the following:

{

type: string, one of the following: 'groceries', 'restaurants', 'transport', 'education', 'health'
cpf: cpf of employee, string containing only numbers

}

Employees can only have one card of each type. A successful request will create and return the created card data. It is important to store the information safely, as some sensitive data will be stored encrypted and will not be possible to be retrieved later, in case of loss the lost card will have to be deleted and a new card created.

POST /cards/activate

Activate a card. Card must already be created by the company.

{

cardNumber: card number, as a string, returned upon card creation
cvc: 3 digit numerical security code, as a string, also returned upon card creation
newPassword: 4 digit numerical string

}

POST /cards/transactions

Get all transactions of a card. Send request with:

{

cardNumber: same as above
cvc: same as above

}

The returned JSON will be:

{

balance: total card balance,
transactions: array of objects containing all payments, keys are:
	id: transaction id
	cardId: card id
	businessId: id of business balance was spent
	businessName: name of business
	timestamp: date in format DD/MM/YYYY
	amount: amount spent
recharges: array of objects containing all recharges the card received, keys are:
	id: recharge id
	cardId: same as above
	timestamp: same as above
	amount: amount deposited as credit in card

}

POST /cards/recharge

This endpoint allows the company the employee works in to recharge their card, send the API header with:

{

type: type of card,
cpf: cpf of employee,
amount: amount to be deposited

}

POST /cards/block

Blocks and unblocks a card. Send request with:

{

cardNumber,
cvc,
password: 4 digit string set upon card activation

}

The API will reply with a JSON informing the state of the block situation of the card as:

{

isBlocked: boolean

}

POST /buy

Make a purchase from a business. Send a request with the following:

{

cardNumber,
password,
businessName,
amount: amount to be spent

}

The purchase can only be completed if the card has enough balance

POST /online

Same idea, to buy something, but now online. Request:

{

cardNumber,
cvc,
expirationDate: expiration date of card
businessName,
amount

}

All data must match. Purchase only to be completed if card has enough balance.

πŸ‘¨β€πŸ’» Author

Made with care by

Felipe Ventura

Gmail Badge

Linkedin Badge

You might also like...

A free & open source project to save your passwords, notes & credit cards

Free & open source project to save your passwords, notes & credit cards with a clean console UI with multiples features such as show information/create information/delete information

Aug 8, 2022

A front-end only implementation of linked template cards for Lovelace

A front-end only implementation of linked template cards for Lovelace

Linked Lovelace by @daredoes A Javascript/Websocket way to do templating in the Lovelace UI Support Hey you! Help me out for a couple of 🍻 or a β˜• ! F

Dec 12, 2022

Register your username, log into the app and create your list of a to-do with local storage.

Register your username, log into the app and create your list of a to-do with local storage.

Todofy Todofy is a web app to create your to-do list with local storage. Explore the docs Β» View Demo Β· Report Bug Β· Request Feature Table of Contents

Jun 30, 2022

A Tailwind plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and all variations.

Tailwind Labeled Groups A plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and

Nov 21, 2022

Create a card layout that let your user flip through it like you see on Google Tips

#Tip Cards by Pete R. Create an animated card layout that let your viewer flip through it like you see on Google Tips Page. Created by Pete R., Founde

Nov 5, 2022

Another logger in JS. This one offers a console.log-like API and formatting, colored lines and timestamps (or not if desired), all that with 0 dependencies.

Another logger in JS. This one offers a console.log-like API and formatting, colored lines and timestamps (or not if desired), all that with 0 dependencies.

hellog Your new logger ! hellog is a general-purpose logging library. It offers a console.log-like API and formatting, extensible type-safety colored

Jan 5, 2022

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card.

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card. Uses simplenotsimpler/modern-table library.

Feb 17, 2022

An easy and simple way to manage your financial transactions.

An easy and simple way to manage your financial transactions.

MyWallet An easy and simple way to manage your financial transactions. With MyWallet you can track your incomes and expenses and always keep track of

Nov 16, 2022

Get the latest Flashbots blocks and Flashbots transactions using TypeScript in two lines of code !

mev-blocks-js This package can let you query the Flashbots blocks API easily from any JavaScript or TypeScript project. You can access the Flashbots b

May 14, 2022
Owner
Felipe Ventura
Hi! I'm an aspiring software developer/engineer taking a full stack web development bootcamp!
Felipe Ventura
Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript and Node.js.

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript and Node.js.

Berry 243 Jan 8, 2023
Create, sign & decode Solana transactions with minimum deps

micro-sol-signer Create, sign & decode Solana transactions with minimum deps. Tiny: 674 LOC, 3K LOC with all deps bundled No network code in main pack

Paul Miller 32 Nov 23, 2022
Create, sign & decode BTC transactions with minimum deps.

micro-btc-signer Create, sign & decode BTC transactions with minimum deps. ?? Small: ~2.2K lines Create transactions, inputs, outputs, sign them No ne

Paul Miller 19 Dec 30, 2022
Transform and compose data for HTTP transactions.

Fragments Fragments is a platform to compose and manage custom data objects for HTTP transactions. Simply put, you can write simple jinja templates to

Artem Golub 15 Sep 6, 2022
Unfurl links into rich cards, as seen in places like Slack and Twitter

eleventy-plugin-unfurl Turn URLs into rich cards. Show a preview image, page title, description and other meta information all inside a neatly present

David Darnes 38 Dec 16, 2022
Cards Against Humanity Game Client made with ⚑Nextron (Next.js + Electron) and Typescript

CAH Client Introduction This project is one of the other projects related to the Cards Against Humanity (CAH) game. This client is made in Electron, u

null 3 Jun 17, 2022
πŸ‘Ύ Simple creating cards using canvas. Welcome, Rank, Info and so on.

⭐ discord-canvas-card Are you developing a bot using DiscordJS and you need beautiful images created using Canvas? You can create great welcome, goodb

Gusarov 6 Dec 18, 2022
Additional themes for Lovelace Mushroom Cards πŸ„

?? Mushroom Themes Mushroom themes allow you to customize your Mushroom dashboard using Home Assistant themes. ⚠️ It's only a theme! You need to insta

Paul Bottein 127 Dec 24, 2022
Customizable Codegrepper Stat cards.

CodeGrepper Cards Render your grepper data on your profile. The average server reponse is around 3seconds on the first request. Config Base URL https:

Jareer Abdullah 1 Apr 24, 2022