E-Wallet Rest Api Example. Using Node.js, Express and MongoDB.
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
yarn dev
yarn start
https://ewallet-rest-api.herokuapp.com/v1/docs/
https://ewallet-rest-api.herokuapp.com/
https://github.com/mmucito/ewallet-rest-api/blob/master/ewallet.postman_collection.json
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'
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'
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'
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
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'
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.001,000 > x <= 5,000 | 2.5% | $6.005,000 > x <= 10,000. | 2.0% | $4.0010,000 > x | 1.0% | $3.00
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
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'
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 code with ESLint
yarn lint
# try to fix ESLint errors
yarn lint:fix
# run all tests with Mocha
yarn test
# run lint and tests
yarn validate
# show logs in production
pm2 logs
# generate and open api documentation
yarn docs
# 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
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
This project is licensed under the MIT License
Using express-rest-es2017-boilerplate as a Starter Seed.
为了使用web服务,我们首先需要创建它。我们使用Flask(http://flask.pocoo.org),一个基于python创建简单的颜色web服务的HTTP服务器应用。你也可以使用其它的web服务器,只要它接收和返回JSON数据。通过web服务来管理一组已经命名的颜色。在这个例子中,管理意味着CRUD(创建-读取-更新-删除)。 在Flask中一个简单的web服务可以写入一个文件。我们使用一
附注:使用mongo DB进行此操作 首先是完全错误
Storm UI 守护程序提供了一个 REST API, 允许您与 Storm 集群进行交互, 其中包括检索 metrics(度量)数据和配置信息, 启动或停止 topologies(拓扑)的管理操作。 数据格式 该 REST API 返回 JSON 响应并支持 JSONP. 客户端可以传回一个回调查询参数, 以在回调函数中包装 JSON。 REST API allows CORS by defa
通用Activiti REST原则 安装与认证 activiti 包含了一个activiti引擎的REST API,把activiti-rest.war部署到像Apache Tomcat这样的servlet容器就可以使用。不过,它也可以使用在其他web应用中,把activiti-rest的依赖都加入 classpath,添加servlet,并映射到你的应用中。 默认情况下,activiti引擎会连
API RESTful em Express, Mongoose, Mocha e Chai. Scripts Os seguintes scripts estão disponiveis com yarn run SCRIPT ou npm run SCRIPT Script Descrição test Roda o linter, roda os testes unitários e os