Skip to content

Latest commit

 

History

History
121 lines (93 loc) · 3.45 KB

README.md

File metadata and controls

121 lines (93 loc) · 3.45 KB

ubademy.service.payments

Tests Deploy

Payments microservice for Ubademy

This service manages:

  • SmartContract deployment in kovan network
  • User Wallets
  • Transactions from the SmartContract

For further information visit Ubademy Payments

Check out the SmartContract in Etherscan!

API deployed at: ubademy-service-payments 🚀

Technologies

Architecture

Directory structure (based on Onion Architecture):

├── contracts
│   └── BasicPayments.sol
├── deployments
│   └── kovan
├── src
│   ├── handlers
│   │   ├── createDepositHandler.js
│   │   ├── createPaymentHandler.js
│   │   ├── createWalletHandler.js
│   │   ├── getTransactionHandler.js
│   │   ├── getTransactionMetricsHandler.js
│   │   ├── getTransactionsHandler.js
│   │   ├── getUbademyWalletHandler.js
│   │   └── getWalletHandler.js
│   ├── infrastructure
│   │   ├── transaction
│   │   │   └── transactionDTO.js
│   │   ├── wallet
│   │   │   └── walletDTO.js
│   │   └── database.js
│   ├── models
│   │   ├── metrics.js
│   │   ├── transactions.js
│   │   └── wallet.js
│   ├── services
│   │   ├── contractInteraction.js
│   │   ├── metrics.js
│   │   ├── services.js
│   │   ├── transactions.js
│   │   └── wallets.js
│   ├── app.js
│   ├── config.js
│   ├── exceptions.js
│   ├── routes.js
│   └── server.js
└── __tests__

Installation

.env

Make sure you add a .env file in the project's root directory. It should include the following variables:

MNEMONIC=your_mnemonic_separated_with_underscores
INFURA_API_KEY=selfExplanatory
COMMISSION=<payment-commission>
MICROSERVICES=<microservices-dict>
  • payment-commission: float between 0 and 1
  • microservices-dict: {microservice-name: microservice-url}

Dependencies:

Once you have installed these tools, npm will take care of the rest 😌

npm i

Usage

Run the API locally

make run

Reset Database and then run locally

make reset

Run tests

npm test

Access API Swagger

Once the API is running you can check all available endpoints at http://127.0.0.1:8000/docs#/