https://github.com/struckchure/demo-credits
Demo Wallet API
https://github.com/struckchure/demo-credits
api docker docker-compose express knexjs mongodb nginx nodejs rest-api
Last synced: 4 months ago
JSON representation
Demo Wallet API
- Host: GitHub
- URL: https://github.com/struckchure/demo-credits
- Owner: struckchure
- Created: 2022-10-14T18:15:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-11T04:44:26.000Z (over 3 years ago)
- Last Synced: 2025-08-13T19:40:05.213Z (11 months ago)
- Topics: api, docker, docker-compose, express, knexjs, mongodb, nginx, nodejs, rest-api
- Language: JavaScript
- Homepage: https://demo-credits.struckchure.com
- Size: 281 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Demo Credit API
[](https://github.com/struckchure/demo-credits/actions/workflows/aws-deploy.yml)
Demo Credit is a wallet service. This is needed as borrowers need a wallet to receive the loans they have been granted and also send the money for repayments.
## ER Diagram

## API Documentation
Base URL: `https://mohammed-lendsqr-be-test.struckchure.com`
Default headers:
```json
{
"Content-Type": "application/json",
"Accept": "application/json"
}
```
# user endpoints
- `GET /api/v1/user/register` - Register a user
Sample Payload:
All fields are required for registering a user.
```json
{
"username": "username",
"password": "password"
}
```
Sample Response(201):
```json
{
"data": {
"id": "",
"username": "username",
"password": "password",
"token": "",
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```
- `POST /api/v1/user/login` - Login a user / obtain a token
Sample Payload:
All fields are required for logging in a user.
```json
{
"username": "username",
"password": "password"
}
```
Sample Response (200):
```json
{
"data": {
"id": "",
"username": "username",
"token": "",
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```
# wallet endpoints
Authentication is required for all wallet endpoints. Tokens are obtained from the user endpoints.
Default headers:
```json
{
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer "
}
```
- `POST /api/v1/wallet` - Create a wallet
Sample Payload: No payload is required for creating a wallet.
Sample Response (201):
```json
{
"data": {
"id": "",
"user": "",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```
- `GET /api/v1/wallet` - Get a user's wallet
Sample Response(200):
```json
{
"data": {
"id": "",
"user": "",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```
- `POST /api/v1/wallet/fund` - Fund a wallet
Sample Payload:
All fields are required for funding a wallet.
```json
{
"amount": 100
}
```
Sample Response(200):
```json
{
"data": {
"id": "",
"user": "",
"balance": 100,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```
- `POST /api/v1/wallet/withdraw` - Withdraw from a wallet
Sample Payload:
All fields are required for withdrawing from a wallet.
```json
{
"amount": 100
}
```
Sample Response(200):
```json
{
"data": {
"id": "",
"user": "",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```
- `POST /api/v1/wallet/transfer` - Transfer money from one user to another
Sample Payload:
All fields are required for transferring money from one user to another.
```json
{
"amount": 100,
"username": ""
}
```
Sample Response(200):
```json
{
"data": {
"id": "",
"user": "",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
```