Skip to content

Development of an API for simulating a Digital Bank functionalities

License

Notifications You must be signed in to change notification settings

Weavous/LaravelBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Bank

License Languages Last Commit

Development of an API for simulating a Digital Bank functionalities

Instructions 🔗

Instructions for developing the application can be found in the icon above.

Installation ⚙️

✔️ Requirements

PHP Logo MySQL Logo Git Logo Composer Logo Docker Logo

    return [
        {
            dependency: "PHP",
            url: "https://www.php.net",
            version: 7.4.21,
            img: "https://cdn.iconscout.com/icon/free/png-256/php-3629567-3032350.png"
        },
        {
            dependency: "MySQL",
            url: "https://www.mysql.com",
            version: 8.0.25,
            img: "https://cdn.iconscout.com/icon/free/png-256/mysql-3628940-3030165.png"
        },
        {
            dependency: "Git",
            url: "https://git-scm.com",
            version:  2.32.0,
            img: "https://cdn.iconscout.com/icon/free/png-256/git-16-1175195.png"
        },
        {
            dependency: "Composer",
            url: "https://getcomposer.org",
            version: 2.1.3,
            img: "https://cdn.iconscout.com/icon/free/png-256/composer-285363.png"
        },
        {
            dependency: "Docker",
            url: "https://www.docker.com",
            version: 20.10.8,
            img: "https://cdn.iconscout.com/icon/free/png-256/composer-285363.png"  
        }
    ];
Backend 🛰
    composer create-project laravel/laravel server
Storage
    CREATE DATABASE custom_development_bank;

Next, add the following database configuration information

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=<database-name>
    DB_USERNAME=<database-username>
    DB_PASSWORD=<database-password>
JWT Guide Link🔐

Guide link to implement JSON Web Token (JWT) authentication

Controllers
    php artisan make:controller APIController

    php artisan make:controller WalletController --api

    php artisan make:controller TransactionController
Models
    php artisan make:model Transaction

    php artisan make:model Wallet
Migrations
    php artisan make:migration create_wallets_table

    php artisan make:migration create_transactions_table
Seeders
    php artisan make:seeder UserSeeder
Tests
    php artisan make:test JWTAuthTest

    php artisan make:test WalletControllerTest

    php artisan make:test TransactionControllerTest

Edit backend\phpunit.xml, setting DB_CONNECTION and DB_DATABASE values

Launch 🚀
    git clone https://github.com/Weavous/LaravelBank
    cd LaravelBank
Set up Application 🚀
    cd backend
    cp .env.example .env

You must specify the environment configuration in .env file

    composer i
    php artisan key:generate
    php artisan migrate:fresh --seed
    php artisan jwt:secret
    php artisan serve
Run with Docker

After doing the project setup, follow the steps.

Clone o repositório https://github.com/Whopag/DockerPHPMySQL

Copy the contents of LaravelBank/server to DockerPHPMySQL/html

Inside DockerPHPMySQL, build an image of the project

    docker-compose up -d --build

Change the content of the following environment variables

    DB_HOST=dockerphpmysql_mysql_1
    DB_PASSWORD=secret
    DB_DATABASE=laravel

Run Laravel migrations

    docker-compose run --rm artisan migrate --seed

Create an Laravel application key

    docker-compose run --rm artisan key:generate
Testing User
    return {
        email: "[email protected]",
        password: "secret"
    }
Noções básicas sobre o aplicativo
Authentication

POST /api/registers criará um novo registro de usuário

POST /api/auth/login retornará um token de autorização para um usuário previamente cadastrado no sistema

POST /api/auth/logout encerrará o token de autorização previamente criado para um usuário autenticado

GET /api/auth/user retornará os dados de cadastro de um usuário

Wallets

GET /api/wallets retornará os dados da carteira do usuário

POST /api/wallets criará uma carteira para um usuário

DELETE /api/wallets excluirá a carteira do usuário

PUT /api/wallets atualizará os dados da carteira do usuário

SHOW /api/wallets retornará os dados da carteira do usuário

Transactions

POST /api/wallets/withdraw realizará uma retirada na carteira do usuário

POST /api/wallets/deposit realizará um depósito na carteira do usuário

4 folder structures to organize your React & React Native project 💾

⚠️ Atenção - Possívels Erros
  • A porta esperada para enviar as requisições é 8000, se outra for estabelecida, alterar o conteúdo de baseURL em frontend\src\services\http.js.

  • Caso ocorra algum erro na instalação das dependências do Laravel através do Composer, deve-se habilitar as extensões presentes no arquivo de configuração php.ini.

  • O local do arquivo de configuração php.ini pode ser visualizado digitando-se php --ini no terminal.

  • Caso ocorra um erro relacionado ao certificado SSL ao efetuar as requisições para o serviço externo, retornando uma mensagem de erro semelhante à essa cURL error 60: SSL certificate problem: unable to get local issuer certificate, pode-se resolver através da resposta presente em https://stackoverflow.com/questions/24611640/curl-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate

Dúvidas ❔
  • Quaisquer dúvidas ou sugestões quanto ao projeto, entrar em contato com [email protected].

About

Development of an API for simulating a Digital Bank functionalities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published