FinWallet is a secure, efficient, and user-friendly digital wallet application. Designed for modern financial management, it supports functionalities like balance management, secure transactions, deposit handling, and detailed reversal request workflows. This application is ideal for both end-users and administrators, providing a seamless experience with robust backend capabilities.
-
User Features:
- View current balance.
- Perform secure deposits and transfers.
- View transaction history with detailed information.
- Request transaction reversals.
-
Admin Features:
- Admin dashboard with metrics:
- Total users.
- Total transactions.
- Pending reversal requests.
- Manage users:
- Edit user information.
- Delete user accounts.
- Handle reversal requests:
- Approve or reject with real-time updates.
- View and analyze detailed transaction logs.
- Admin dashboard with metrics:
- Backend: Laravel 11 (PHP 8.2)
- Frontend: Tailwind CSS, Blade Templates
- Database: MySQL
- Authentication: Laravel Breeze
- Containerization: Docker
- Version Control: Git
- Observability: Logging and request monitoring with Laravel Telescope (optional)
- PHP: >= 8.2
- Laravel: 11
- Composer: >= 2.0
- Node.js: >= 18.x with npm or Yarn
- Database: MySQL 8.0 or compatible
- Optional: Docker with Docker Compose
- Ensure PHP, Composer, and Node.js are installed.
- Set up a MySQL database for the project.
-
Clone the repository:
https://github.com/Thomas-DEV7/finwallet cd finwallet
-
Install PHP dependencies:
composer install
-
Install Node.js dependencies:
npm install npm run build
-
Set up the environment:
cp .env.example .env php artisan key:generate
-
Configure the
.env
file with:- Database credentials
- Mail settings (for password recovery emails)
-
Run database migrations and seeders:
php artisan migrate --seed
-
Start the development server:
php artisan serve
-
Access the application at:
http://localhost:8000
-
Build and start the Docker containers:
docker-compose up -d --build
-
Install dependencies:
docker exec -it finwallet-app composer install docker exec -it finwallet-app npm install docker exec -it finwallet-app npm run build
-
Set up the environment and application key:
docker exec -it finwallet-app cp .env.example .env docker exec -it finwallet-app php artisan key:generate
-
Run database migrations and seeders:
docker exec -it finwallet-app php artisan migrate --seed
-
Start Laravel's development server:
docker exec -it finwallet-app php artisan serve --host=0.0.0.0 --port=8000
-
Access the application at:
http://localhost:8000
emails:
'[email protected]' (ADMIN)
'[email protected]' (User)
'[email protected]' (User)
'[email protected]' (user)
- app/
- Http/
- Controllers/ # Application controllers
- Middleware/ # Custom middlewares
- Models/ # Eloquent models
- database/
- migrations/ # Database migrations
- seeders/ # Database seeders
- resources/
- views/ # Blade templates
- css/ # Custom styles
- js/ # JavaScript files
- routes/
- web.php # Web routes
- public/
- images/ # Static assets (e.g., logo)
Represents users in the application.
- Attributes:
uuid
,name
,email
,password
,role
,balance
.
Tracks all user transactions.
- Attributes:
uuid
,user_id
,sender_id
,recipient_id
,amount
,type
,related_transaction_id
.
Handles requests for transaction reversals.
- Attributes:
uuid
,user_uuid
,transaction_uuid
,comment
,status
.
Method | Endpoint | Action |
---|---|---|
GET | /dashboard | Show user dashboard |
POST | /wallet/deposit | Handle deposit transactions |
POST | /wallet/transfer | Handle balance transfers |
POST | /transactions/reversal-request | Submit reversal request |
Method | Endpoint | Action |
---|---|---|
GET | /admin/dashboard | Admin dashboard overview |
GET | /admin/users | Manage users |
POST | /admin/reversal-requests/{uuid}/approve | Approve reversal request |
POST | /admin/reversal-requests/{uuid}/reject | Reject reversal request |
Displays key metrics:
- Total users.
- Total transactions.
- Pending reversal requests.
- Logs of recent transactions (latest 10).
- Transaction types include:
deposit
: Adding funds to a user's account.transfer
: Moving funds between users.refund
: Reversal of a previous transaction.
- Prevent duplicate requests for the same transaction.
- Admins can approve or reject requests.
- Creates initial users and transaction records for testing:
- Users: Includes admin and multiple regular users.
- Transactions: Various types to simulate real-world data.
O teste verifica a criação de um usuário no banco de dados, assegurando que a senha seja armazenada como um hash seguro.
<?php
namespace Tests\Feature;
use Tests\TestCase;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
class UserTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_creates_a_user_successfully()
{
// Dados simulados de um usuário
$userData = [
'uuid' => (string) \Illuminate\Support\Str::uuid(),
'name' => 'Test User',
'email' => '[email protected]',
'password' => Hash::make('password123'), // Usando Hash::make
'role' => 'user',
'balance' => 500.00,
];
// Criar o usuário
$user = User::create($userData);
// Verificar se o usuário foi criado corretamente no banco de dados
$this->assertDatabaseHas('users', [
'email' => '[email protected]',
'name' => 'Test User',
]);
// Verificar se a senha foi armazenada como um hash
$this->assertTrue(Hash::check('password123', $user->password));
}
}