All Projects β†’ mmucito β†’ ewallet-rest-api

mmucito / ewallet-rest-api

Licence: MIT license
E-Wallet Rest Api Example. Using Node.js, Express and MongoDB.

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to ewallet-rest-api

Express Boilerplate
πŸš€ Starter project for a RESTful API in Node with Express & mongoose component-based
Stars: ✭ 9 (-89.89%)
Mutual labels:  yarn, mongoose
Quora
Building An Exclusive Community of PEC Graduates and Students.The main features of the website are β€œPEC Quora” and β€œPEC Connect”
Stars: ✭ 26 (-70.79%)
Mutual labels:  yarn, mongoose
Vue Blog
A single-user blog built with vue2, koa2 and mongodb which supports Server-Side Rendering
Stars: ✭ 586 (+558.43%)
Mutual labels:  yarn, mongoose
Express Mongoose Es6 Rest Api
πŸ’₯ A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication
Stars: ✭ 2,811 (+3058.43%)
Mutual labels:  yarn, mongoose
koa-mongoDB
😊😊Koa and mongoose build services
Stars: ✭ 24 (-73.03%)
Mutual labels:  yarn, mongoose
nuada-cli
Nuada CLI was designed to improve your development experience by using ExpressJS and Mongoose tools.
Stars: ✭ 19 (-78.65%)
Mutual labels:  yarn, mongoose
Registration-and-Login-using-MERN-stack
Simple Registration and Login component with MERN stack
Stars: ✭ 210 (+135.96%)
Mutual labels:  yarn, mongoose
node-server-template
This is Node.js server tidy template / boilerplate with Express (with asyncified handlers, custom error handler) framework and MongoDb. The server use ES6 and above. On different branches you can see different techniques' and technologies' usage, such as Kafka, nodemailer, file download... You also can find postman collections.
Stars: ✭ 116 (+30.34%)
Mutual labels:  yarn, mongoose
uuid-mongodb
πŸ“‡ Generates and parses MongoDB BSON UUIDs
Stars: ✭ 94 (+5.62%)
Mutual labels:  mongoose
aircnc
β˜• Airbnb like (Air Coffee & Code) to booking spots for developers using ReactJS, React Native, Node.js and more.
Stars: ✭ 37 (-58.43%)
Mutual labels:  mongoose
ng-nest-cnode
Angular 10 Front-End and Nestjs 7 framework Back-End build Fullstack CNode
Stars: ✭ 17 (-80.9%)
Mutual labels:  mongoose
double-bundle
Example for integrating React NPM dependencies with Clojurescript
Stars: ✭ 23 (-74.16%)
Mutual labels:  yarn
docker-symfony
Docker Symfony (PHP-FPM - NGINX - MySQL - MailHog - Redis - RabbitMQ)
Stars: ✭ 32 (-64.04%)
Mutual labels:  yarn
mini-express-boilerplate
A minimal Express boilerplate with passport user authentication, mongoose and some security setup configured
Stars: ✭ 15 (-83.15%)
Mutual labels:  mongoose
storage
Mongoose-like schema validation, collections and documents on browser (client-side)
Stars: ✭ 17 (-80.9%)
Mutual labels:  mongoose
manager
OVHcloud Control Panel
Stars: ✭ 153 (+71.91%)
Mutual labels:  yarn
Online-Examination-System
Technologies : React js, Node js, Express js, Mongo Db, Ant Design, Redux js Key features: 1. User management 2. Modular code 3. Permission management 4. Persistent answers on page refresh in the test portal 5. Examination results using graphs 6. Results can directly be downloaded as excel sheet 7. Feedback system
Stars: ✭ 37 (-58.43%)
Mutual labels:  mongoose
koa-server
πŸ—„οΈ GraphQL Back-end Server with Relay, Koa, MongoDB and Mongoose
Stars: ✭ 31 (-65.17%)
Mutual labels:  mongoose
coconat
πŸ₯ StarterKit Builder for rocket-speed App creation on πŸš€ React 17 + πŸ“™ Redux 4 + 🚠 Router 5 + πŸ“ͺ Webpack 5 + 🎳 Babel 7 + πŸ“œ TypeScript 4 + πŸš” Linters 23 + πŸ”₯ HMR 3
Stars: ✭ 95 (+6.74%)
Mutual labels:  yarn
BEW-1.3-Server-Side-Architectures-and-Frameworks
πŸ” Build on knowledge of Resourceful and RESTful patterns and dive deep into the Node and Express ecosystem.
Stars: ✭ 19 (-78.65%)
Mutual labels:  mongoose

E-Wallet Rest Api

E-Wallet Rest Api Example. Using Node.js, Express and MongoDB.

Requirements

Getting Started

Clone the repo:

git clone https://github.com/mmucito/ewallet-rest-api.git
cd ewallet-rest-api

Install yarn:

npm install -g yarn

Install dependencies:

yarn

Set environment variables:

cp .env.example .env

Running Locally

yarn dev

Running in Production

yarn start

API Reference

https://ewallet-rest-api.herokuapp.com/v1/docs/

API Endpoint

https://ewallet-rest-api.herokuapp.com/

API Postman Collection for Testing

https://github.com/mmucito/ewallet-rest-api/blob/master/ewallet.postman_collection.json

Testing Locally...

First you need to Create a Customer

curl -X POST \
  http://localhost:3000/v1/auth/register \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: 030c9874-23c0-367b-7e2b-aea506e851c4' \
  -d 'email=jhon_doe%40gmail.com&password=123456&name=Jhon%20Doe'

Login

curl -X POST \
  http://localhost:3000/v1/auth/login \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: b309972f-4942-d788-30a0-df86f4f1b854' \
  -d 'email=jhon_doe%40gmail.com&password=123456'

Get eWallet Balance

curl -X GET \
  http://localhost:3000/v1/ewallet/balance \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MDc3NDM4MTgsImlhdCI6MTUwNzc0MjkxOCwic3ViIjoiNTlkZTUzZDVhYzM5ZmQ1ODQ3MGRjODI4In0.mUry4SFaWRqRrBmNF1RBBnJMvcvJBYAktqczpMj8r2w' \
  -H 'cache-control: no-cache' \
  -H 'postman-token: 6df0eb80-e0fc-5f47-4b72-2f3f165eeaaf'

Make a Deposit to your eWallet

curl -X POST \
  http://localhost:3000/v1/ewallet/deposit \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MDc3NDM4MTgsImlhdCI6MTUwNzc0MjkxOCwic3ViIjoiNTlkZTUzZDVhYzM5ZmQ1ODQ3MGRjODI4In0.mUry4SFaWRqRrBmNF1RBBnJMvcvJBYAktqczpMj8r2w' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: 66218aae-19ee-3761-e0c0-53823d0d4820' \
  -d 'amount=10&card=4111111111111111'

Note: You can simulate a Payment Rejected by the PaymentGateway using this card 4242424242424242

Get eWallet Transactions

curl -X GET \
  http://localhost:3000/v1/ewallet/transactions \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MDc3NDM4MTgsImlhdCI6MTUwNzc0MjkxOCwic3ViIjoiNTlkZTUzZDVhYzM5ZmQ1ODQ3MGRjODI4In0.mUry4SFaWRqRrBmNF1RBBnJMvcvJBYAktqczpMj8r2w' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: ff68cdff-9fac-9647-4594-70315ab1f4cd'

Make a Transfer to another eWallet

curl -X POST \
  http://localhost:3000/v1/ewallet/transfer \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MDc3NjYyOTgsImlhdCI6MTUwNzc2NTM5OCwic3ViIjoiNTlkZWE4ZDA2YzkyYmQ2ZTdkZjZiMzMwIn0.PGSdiEpPG43ihnJldKFY-MMqNzaGb4PwOylUbA05AVY' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: 78116228-4061-257a-f47c-37033d474596' \
  -d 'amount=100&destinationAccountNumber=1001'

Note: Every Transaction will generate a fee that will be discounted from the eWallet Balance and will be credited to the Master Account according to this table.

Amount | Percent | Fixed rate |---|---|---|---|---| x <= 1,000 | 3.0% | $8.00 1,000 > x <= 5,000 | 2.5% | $6.00 5,000 > x <= 10,000. | 2.0% | $4.00 10,000 > x | 1.0% | $3.00

Triggers a Withdrawal from your eWallet

curl -X POST \
  http://localhost:3000/v1/ewallet/withdrawal \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MDc3NzI5NjAsImlhdCI6MTUwNzc3MjA2MCwic3ViIjoiNTlkZWE4ZDA2YzkyYmQ2ZTdkZjZiMzMwIn0.SF8OdwKfT-fiWbkhUgnTKWfyeZCY_p3ek4j2dPVukuc' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: d2292d62-cefd-e7b9-311a-12fe92795c79' \
  -d 'amount=1500&card=4111111111111111'

Note: You can simulate a Failure on the Withdrawal Gateway using this card 4242424242424242

Master Account Info

Login

curl -X POST \
  http://localhost:3000/v1/auth/login \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: 4e2b3f90-343e-7643-89a3-957dc0ba36c7' \
  -d 'email=master_account%40bank.com&password=master'

Get Master Account Balance

curl -X GET \
  http://localhost:3000/v1/ewallet/balance \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MDc3NDM4MTgsImlhdCI6MTUwNzc0MjkxOCwic3ViIjoiNTlkZTUzZDVhYzM5ZmQ1ODQ3MGRjODI4In0.mUry4SFaWRqRrBmNF1RBBnJMvcvJBYAktqczpMj8r2w' \
  -H 'cache-control: no-cache' \
  -H 'postman-token: 6df0eb80-e0fc-5f47-4b72-2f3f165eeaaf'

Lint

# lint code with ESLint
yarn lint

# try to fix ESLint errors
yarn lint:fix

Test

# run all tests with Mocha
yarn test

Validate

# run lint and tests
yarn validate

Logs

# show logs in production
pm2 logs

Documentation

# generate and open api documentation
yarn docs

Docker

# run container locally
yarn docker:dev
or
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

# run container in production
yarn docker:prod
or
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up

# run tests
yarn docker:test
or
docker-compose -f docker-compose.yml -f docker-compose.test.yml up

Deploy

Set your server ip:

DEPLOY_SERVER=127.0.0.1

Replace my Docker username with yours:

nano deploy.sh

Run deploy script:

yarn deploy
or
sh ./deploy.sh

License

This project is licensed under the MIT License

Using express-rest-es2017-boilerplate as a Starter Seed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].