- About The Project
- Services Available
- Built with
- Getting Started
- Running Tests
- API Reference
- Entity Relationship Diagram
- Roadmap
- Contributing
- License
- Contact
Wallet service is a container-based NestJs Backend server wallet application where users are able to create accounts, fund their wallets, handle transfers bettween wallet owners, withdraw their funds, retrieve transactions history, etc.
Very importantly, this application, features both local and stateless authetication using JSON Web Tokens which has been implemented using Passport library, and payment gateway integration for funds management and use of database transactions to ensure data integrity in critical multi-table queries and operations.
- User registeration
- Email verification
- Login
- Wallet funding
- Transfer between wallets
- Withdrawals
- Transactions history
- Retrieve wallet
- Node.js
- NestJs (Typescript)
- MySQL
- KnexJs Query Builder
- Docker
- Passport.JS (Authentication)
To build the project locall,, bare metal without docker, simply clone the github repository. Navigate to root project folder and run the following to install packages:
$ npm install
and add appropriate .env file in the project root folder
After packages have been installed. Proceed to run:
$ npm run start:dev
After packages have been installed. Proceed to run:
$ npm run start:prod
To run the application in a docker which, depending on the docker CLI tool available in your local system, navigate to the project root foler, add the appropriate .env file
if docker-compose is available in your local system, please run the following commands in your terminal:
$ docker-compose build
$ docker-compose up -d
If the local system is running Linux, sudo
privileges may be need to run the commands appropriately.
To run unit tests, run the following command
$ npm run test
To run coverage test, run the following command
$ npm run test:cov
GET /
Response:
{
"message": "server active!"
}
POST /users
Content-Type: application/json
Response:
{
"email": "string",
"user_id": "string"
}
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Must be a valid email string |
password |
string |
Required. |
PATCH /auth/verify-email
Content-Type: application/json
Response:
{
"message": "success"
}
Parameter | Type | Description |
---|---|---|
email |
string |
Required. |
user_id |
string |
Required. |
token |
string |
Required. Token for verification |
POST /auth/login
Content-Type: application/json
Response:
{
"user_id": "string",
"jwt": "string"
}
Parameter | Type | Description |
---|---|---|
email |
string |
Required. |
password |
string |
Required. |
GET /wallets/me
Authorization: Bearer Token <JWT>
Response:
{
"wallet_id": "string",
"user_id": "string",
"balance": "number",
"currency": "ISO4217 currency code",
"created_at": "date string",
"updated_at": "date string"
}
Parameter | Type | Description |
---|---|---|
wallet_id |
string |
Required. |
This endpoints takes in the amount reuired for funding. It returns the transaction details which includes a link field which is the payment link which will be used to pay over any browser powered by Flutterwave.
POST /transactions/fund-wallet
Content-Type: application/json
Authorization: Bearer Token <JWT>
Response:
{
"link": "string (payment-link)",
"transaction_id": "string",
"ref": "string",
"source": "string",
"amount": "number",
"currency": "NGN",
"status": "PENDING",
"type": "FUNDING"
}
Parameter | Type | Description |
---|---|---|
amount |
number |
Required. |
beneficiary_wallet |
string |
Required. |
POST /transactions/transfer
Content-Type: application/json
Authorization: Bearer Token <JWT>
Response:
{
"message": "success"
}
Parameter | Type | Description |
---|---|---|
amount |
number |
Required. |
wallet |
string |
Required. |
POST /transactions/withdraw
Content-Type: application/json
Authorization: Bearer Token <JWT>
Response:
{
"transaction_id": "string",
"ref": "string",
"source": "string",
"amount": "number",
"currency": "NGN",
"status": "PENDING",
"type": "WITHDRAWAL"
}
Parameter | Type | Description |
---|---|---|
amount |
number |
Required. |
bank_code |
string |
Required. |
account_number |
string |
Required. |
GET /transactions
Authorization: Bearer Token <JWT>
Response:
[{
"transaction_id": "string",
"ref": "string",
"source": "string",
"amount": "number",
"currency": "NGN",
"status": "PENDING",
"type": "WITHDRAWAL"
}]
GET /transactions/:transaction_id
Authorization: Bearer Token <JWT>
Response:
{
"transaction_id": "string",
"ref": "string",
"source": "string",
"amount": "number",
"currency": "NGN",
"status": "PENDING",
"type": "WITHDRAWAL"
}
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU-V3 License. See LICENSE
for more information.
Project Link: https://github.com/nwokoyepraise/wallet-service