rbwallet is an attempt to simulate a virtual wallet where it is possible to make transfers between its users.
- Create a user, which can be common or merchant
- Transfer between users, with merchants only receiving transfers.
- Slim - micro framework for PHP
- Guzzle - PHP HTTP client
- DBAL - Doctrine database abstraction & access layer.
- Mysql - The world's most popular open source database
rbwallet requires Docker and Docker Compose.
Install the dependencies and devDependencies and start the server.
git clone https://github.com/devbenatti/rbwallet.git
cd rbwallet
make configure
docker-compose up -d
To create a user, you must send an HTTP POST request for route /create
. Application will return HTTP status 201
if the creation was a success. Below is an example of payload.
{
"email": "xablau@gmail.com",
"name": "Xablau Testing",
"password": "123",
"document": "11181756039"
}
If you send a document with 14 digits the application will automatically understand that you are a merchant. It's a bad idea, I know, but I will improve it in other versions.
To send money to another user, you must send an HTTP POST request for route /transaction
. Application will return HTTP status 201
and a transaction code
if the creation was a success. Below is an example of payload.
{
"amount": 123.22,
"currency": "BRL",
"payer": 2,
"payee": 1
}
Code | Description |
---|---|
1 | PROCESSING |
2 | SUCCESS |
3 | FAILED |
If payer dont have funds to transfer, application will create a transaction with status FAILED
and set reason to insufficient_funds
. If the transaction is not authorized, application will create transaction with status FAILED
and reason unauthorized
.
To enable testing of money transfer between users, there are some pre-registered users.
ID | Merchant | Balance |
---|---|---|
100 | FALSE | 99999.00 |
101 | TRUE | 0.00 |
102 | FALSE | 1.99 |
To run unit tests
make test
- Deposit money
- Withdraw money
- Balance