PHP Classes

PHP Wallet API and Application: Application to manage a wallet by calling an API

Recommend this page to a friend!
  Info   View files View files (150)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-01-20 (10 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 65 All time: 10,131 This week: 189Up
Version License PHP version Categories
wallet-app 1.0.0GNU Lesser Genera...5PHP 5, Web services, Finances
Description Author

This package provides an application to manage a wallet by calling an API.

It implements an API that performs operations on user wallets like creating payment requests for clients, setting payment and deposit methods, approving or rejecting transactions, checking the wallet balance, etc..

The package also provides a Web application that allows registered users to perform operations on their wallets supported by the wallet API.

Innovation Award
PHP Programming Innovation award nominee
January 2022
Number 6
Wallets are containers that securely store money amounts. Applications can perform different types of operations with money held in wallets.

This package implements an API that can perform several types of operations with wallet money amounts.

Using this API, developers can implement financial applications that do not need to maintain the wallet management services.

Manuel Lemos
Picture of mohammad anzawi
  Performance   Level  
Name: mohammad anzawi <contact>
Classes: 8 packages by
Country: Jordan Jordan
Age: 8
All time rank: 14562 in Jordan Jordan
Week rank: 146 Up1 in Jordan Jordan Up
Innovation award
Innovation award
Nominee: 2x

Details

Wallet App

this app created with * Laravel 8 * React <typescript> * tailwindCss

pleas note :

all files (Classes, methods) are documented well, so you can open any file and read comments if you want to know how things going.

server directory -> Back-End (API)

client directory -> Front-End (APP)

run this app

### Requriments: * composer * Node >=v14.18.1 <=v16.13.1 (v17.2.0 cause errors) * PHP v7.4.0+ * Database :

* Mysql v5.7+
* PostgreSQL 9.6+
* SQL Server 2017+

to run this app on your computer please follow steps,

  • clone this repo or download it.
  • open /server/.env file and setup your database information
  • dont forget to change (APP_URL) from .env file
  • `JWT_TTL` key for JWT token expiration.
  • open your tirminal or CMD and navagate to project directory
  • navagate to /server directory
  • run `composer install` to install dependencies (wait to finish)
  • run `php artisan key:generate` to generate app key
  • run `php artisan jwt:secret` to generate JWT key
  • run `php artisan migrate` to migrate tables to database
  • run `php artisan db:seed` to insert some data into database
      # create user with admin persmissions
       {
          name: Admin, 
          email: admin@admin.com, 
          passowrd: admin123
        }
    
    # create init payment method
    
    
  • run `php artisan storage:link` to link storage with public directory.
  • now your api is ready to deploy
  • you can use (homestead or valet) or for fast you can run `php artisan serve` now your api in http://localhost:8000
  • ----------------------
  • navigate to /client directory
  • run `npm install` to install dependencies (wait to finish)
  • if your back-end url not (http://localhost:8000) :
  • open `/client/src/app/api/agent.ts` file and change
  • `axios.defaults.baseURL = 'http://localhost:8000/api'`
  • to be axios.defaults.baseURL = 'your-url/api'
  • now run `npm start` to start application on http://localhost:3000
  • open http://localhost:3000 in your browser and start testing :)

first thing you want to do is (login as admin and create payment method) if you register as a user , you cant create any transactions if theres no payment methods.

                          

how to setup your database

  • first thing create database -call it anything you want-
  • open your database management tool and run `CREATE DATABASE {database_name}`
  • open /server/.env file and change
  • if .env file not exists copy .env.example and rename it to .env
DB_CONNECTION={database_driver} #(by default its mysql)
DB_HOST={database_host}
DB_PORT=={database_port} # by default (3306)
DB_DATABASE={database_name}
DB_USERNAME={database_username}
DB_PASSWORD={database_user_password}

other configuration

in /server/.env file

# set app url
APP_URL={API_URL}

# set setion limit
JWT_TTL=120 # for 2 hours

note:

This version of the application does not specify the allowed currencies, due to time constraints only.

the main idea its create table currencies related with payments table when user creating transaction just check if the currency he choose is allowd in selected payment method or not, thats it

About the application

wallet management system that has two types of users: admin and client.

Admin section: ? Admin can create a new payment method that will be offered to the clients, the clients can use the predefined payment methods to deposit or withdrawal to their wallet, payment method interface includes the following: Payment method name, payment method image, allowed currencies, min deposit, `max deposit,min withdrawalandmax withdrawal`. ? Admin can approve or reject the transaction (deposit or withdrawal), created by the user. ? Admin can see all users, and he has the power to block any user. ? Admin can show the total transactions with a chart and filtration.

Client section: ? Client can make any transaction (deposit or withdrawal), and wallet will be reflected after admins approval. ? The client can see the wallet balance and he can see the transactions he requested with the status.

                          
                          

                          

when we have only 2 types of users (admin/user) I just make it simple, so I created very simple permission roles its column called (is_admin) in users table.

I know its basic but it does the trick here

  Files folder image Files  
File Role Description
Files folder imageclient (6 files, 2 directories)
Files folder imageserver (11 files, 8 directories)
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  client  
File Role Description
Files folder imagepublic (6 files)
Files folder imagesrc (4 files, 2 directories)
  Accessible without login Plain text file craco.config.js Data Auxiliary data
  Accessible without login Plain text file package-lock.json Data Auxiliary data
  Accessible without login Plain text file package.json Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation
  Accessible without login Plain text file tailwind.config.js Data Auxiliary data
  Accessible without login Plain text file tsconfig.json Data Auxiliary data

  Files folder image Files  /  client  /  public  
File Role Description
  Accessible without login Image file favicon.ico Data Auxiliary data
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file logo192.png Icon Icon image
  Accessible without login Image file logo512.png Data Auxiliary data
  Accessible without login Plain text file manifest.json Data Auxiliary data
  Accessible without login Plain text file robots.txt Doc. Documentation

  Files folder image Files  /  client  /  src  
File Role Description
Files folder imageapp (1 file, 4 directories)
Files folder imagefeatures (2 directories)
  Accessible without login Plain text file index.tsx Data Auxiliary data
  Accessible without login Plain text file react-app-env.d.ts Data Auxiliary data
  Accessible without login Plain text file reportWebVitals.ts Data Auxiliary data
  Accessible without login Plain text file setupTests.ts Data Auxiliary data

  Files folder image Files  /  client  /  src  /  app  
File Role Description
Files folder imageapi (1 file)
Files folder imagelayout (2 files)
Files folder imagemodels (5 files)
Files folder imagestores (7 files)
  Accessible without login Plain text file helpers.ts Data Auxiliary data

  Files folder image Files  /  client  /  src  /  app  /  api  
File Role Description
  Accessible without login Plain text file agent.ts Data Auxiliary data

  Files folder image Files  /  client  /  src  /  app  /  layout  
File Role Description
  Accessible without login Plain text file App.tsx Data Auxiliary data
  Accessible without login Plain text file index.css Data Auxiliary data

  Files folder image Files  /  client  /  src  /  app  /  models  
File Role Description
  Accessible without login Plain text file ErrorResponse.ts Data Auxiliary data
  Accessible without login Plain text file Payment.ts Data Auxiliary data
  Accessible without login Plain text file Transaction.ts Data Auxiliary data
  Accessible without login Plain text file User.ts Data Auxiliary data
  Accessible without login Plain text file Wallet.ts Data Auxiliary data

  Files folder image Files  /  client  /  src  /  app  /  stores  
File Role Description
  Accessible without login Plain text file CommonStore.ts Data Auxiliary data
  Accessible without login Plain text file ErrorsStore.ts Data Auxiliary data
  Accessible without login Plain text file ModalStore.ts Data Auxiliary data
  Accessible without login Plain text file PaymentStore.ts Data Auxiliary data
  Accessible without login Plain text file store.ts Data Auxiliary data
  Accessible without login Plain text file TransactionStore.ts Data Auxiliary data
  Accessible without login Plain text file UserStore.ts Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  
File Role Description
Files folder imagecomponents (4 files, 1 directory)
Files folder imagepages (4 files, 2 directories)

  Files folder image Files  /  client  /  src  /  features  /  components  
File Role Description
Files folder imageRoutes (4 files)
  Accessible without login Plain text file Chart.tsx Data Auxiliary data
  Accessible without login Plain text file ErrorSection.tsx Data Auxiliary data
  Accessible without login Plain text file ModalContainer.tsx Data Auxiliary data
  Accessible without login Plain text file Nav.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  components  /  Routes  
File Role Description
  Accessible without login Plain text file BrowserRouter.tsx Data Auxiliary data
  Accessible without login Plain text file GuestRoute.tsx Data Auxiliary data
  Accessible without login Plain text file PrivateRoute.tsx Data Auxiliary data
  Accessible without login Plain text file UserRoute.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  pages  
File Role Description
Files folder imagedashboard (2 files, 3 directories)
Files folder imageuser (3 files)
  Accessible without login Plain text file Dashboard.tsx Data Auxiliary data
  Accessible without login Plain text file LoginPage.tsx Data Auxiliary data
  Accessible without login Plain text file NotFound.tsx Data Auxiliary data
  Accessible without login Plain text file Register.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  pages  /  dashboard  
File Role Description
Files folder imagePayments (2 files)
Files folder imageTransaction (1 file)
Files folder imageUsers (1 file)
  Accessible without login Plain text file Home.tsx Data Auxiliary data
  Accessible without login Plain text file Menu.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  pages  /  dashboard  /  Payments  
File Role Description
  Accessible without login Plain text file ListPayments.tsx Data Auxiliary data
  Accessible without login Plain text file ManagePayment.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  pages  /  dashboard  /  Transaction  
File Role Description
  Accessible without login Plain text file ListTransactions.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  pages  /  dashboard  /  Users  
File Role Description
  Accessible without login Plain text file ListUsers.tsx Data Auxiliary data

  Files folder image Files  /  client  /  src  /  features  /  pages  /  user  
File Role Description
  Accessible without login Plain text file CreateTransaction.tsx Data Auxiliary data
  Accessible without login Plain text file Profile.tsx Data Auxiliary data
  Accessible without login Plain text file ProfileHistory.tsx Data Auxiliary data

  Files folder image Files  /  server  
File Role Description
Files folder imageapp (6 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (17 files)
Files folder imagedatabase (3 directories)
Files folder imagepublic (4 files)
Files folder imageresources (3 directories)
Files folder imageroutes (4 files)
Files folder imagetests (2 files, 2 directories)
  Accessible without login Plain text file .editorconfig Data Auxiliary data
  Accessible without login Plain text file .env.example Data Auxiliary data
  Accessible without login Plain text file .styleci.yml Data Auxiliary data
  Accessible without login Plain text file artisan Class Class source
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file composer.lock Data Auxiliary data
  Accessible without login Plain text file package.json Data Auxiliary data
  Accessible without login Plain text file phpunit.xml Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation
  Accessible without login Plain text file server.php Aux. Auxiliary script
  Accessible without login Plain text file webpack.mix.js Data Auxiliary data

  Files folder image Files  /  server  /  app  
File Role Description
Files folder imageConsole (1 file)
Files folder imageExceptions (1 file)
Files folder imageHttp (1 file, 2 directories)
Files folder imageModels (4 files)
Files folder imageProviders (5 files)
Files folder imageTransformers (4 files)

  Files folder image Files  /  server  /  app  /  Console  
File Role Description
  Accessible without login Plain text file Kernel.php Class Class source

  Files folder image Files  /  server  /  app  /  Exceptions  
File Role Description
  Accessible without login Plain text file Handler.php Class Class source

  Files folder image Files  /  server  /  app  /  Http  
File Role Description
Files folder imageControllers (3 files, 2 directories)
Files folder imageMiddleware (9 files)
  Accessible without login Plain text file Kernel.php Class Class source

  Files folder image Files  /  server  /  app  /  Http  /  Controllers  
File Role Description
Files folder imageAuth (3 files)
Files folder imageWallet (2 files)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file PaymentController.php Class Class source
  Accessible without login Plain text file UserController.php Class Class source

  Files folder image Files  /  server  /  app  /  Http  /  Controllers  /  Auth  
File Role Description
  Accessible without login Plain text file LoginController.php Class Class source
  Accessible without login Plain text file LogoutController.php Class Class source
  Accessible without login Plain text file RegisterController.php Class Class source

  Files folder image Files  /  server  /  app  /  Http  /  Controllers  /  Wallet  
File Role Description
  Accessible without login Plain text file TransactionsController.php Class Class source
  Accessible without login Plain text file WalletController.php Class Class source

  Files folder image Files  /  server  /  app  /  Http  /  Middleware  
File Role Description
  Accessible without login Plain text file Authenticate.php Class Class source
  Accessible without login Plain text file EncryptCookies.php Class Class source
  Accessible without login Plain text file OnlyAdmin.php Class Class source
  Accessible without login Plain text file PreventRequestsDuringMaintenance.php Class Class source
  Accessible without login Plain text file RedirectIfAuthenticated.php Class Class source
  Accessible without login Plain text file TrimStrings.php Class Class source
  Accessible without login Plain text file TrustHosts.php Class Class source
  Accessible without login Plain text file TrustProxies.php Class Class source
  Accessible without login Plain text file VerifyCsrfToken.php Class Class source

  Files folder image Files  /  server  /  app  /  Models  
File Role Description
  Accessible without login Plain text file Payment.php Class Class source
  Accessible without login Plain text file Transaction.php Class Class source
  Accessible without login Plain text file User.php Class Class source
  Accessible without login Plain text file Wallet.php Class Class source

  Files folder image Files  /  server  /  app  /  Providers  
File Role Description
  Accessible without login Plain text file AppServiceProvider.php Class Class source
  Accessible without login Plain text file AuthServiceProvider.php Class Class source
  Accessible without login Plain text file BroadcastServiceProvider.php Class Class source
  Accessible without login Plain text file EventServiceProvider.php Class Class source
  Accessible without login Plain text file RouteServiceProvider.php Class Class source

  Files folder image Files  /  server  /  app  /  Transformers  
File Role Description
  Accessible without login Plain text file PaymentTransformer.php Class Class source
  Accessible without login Plain text file TransactionsTransformer.php Class Class source
  Accessible without login Plain text file UserTransformer.php Class Class source
  Accessible without login Plain text file WalletTransformer.php Class Class source

  Files folder image Files  /  server  /  bootstrap  
File Role Description
  Accessible without login Plain text file app.php Class Class source

  Files folder image Files  /  server  /  config  
File Role Description
  Accessible without login Plain text file app.php Class Class source
  Accessible without login Plain text file auth.php Class Class source
  Accessible without login Plain text file broadcasting.php Aux. Auxiliary script
  Accessible without login Plain text file cache.php Aux. Auxiliary script
  Accessible without login Plain text file cors.php Aux. Auxiliary script
  Accessible without login Plain text file database.php Aux. Auxiliary script
  Accessible without login Plain text file filesystems.php Aux. Auxiliary script
  Accessible without login Plain text file fractal.php Class Class source
  Accessible without login Plain text file hashing.php Aux. Auxiliary script
  Accessible without login Plain text file jwt.php Class Class source
  Accessible without login Plain text file logging.php Class Class source
  Accessible without login Plain text file mail.php Aux. Auxiliary script
  Accessible without login Plain text file queue.php Aux. Auxiliary script
  Accessible without login Plain text file sanctum.php Class Class source
  Accessible without login Plain text file services.php Aux. Auxiliary script
  Accessible without login Plain text file session.php Aux. Auxiliary script
  Accessible without login Plain text file view.php Aux. Auxiliary script

  Files folder image Files  /  server  /  database  
File Role Description
Files folder imagefactories (1 file)
Files folder imagemigrations (11 files)
Files folder imageseeders (3 files)

  Files folder image Files  /  server  /  database  /  factories  
File Role Description
  Accessible without login Plain text file UserFactory.php Class Class source

  Files folder image Files  /  server  /  database  /  migrations  
File Role Description
  Accessible without login Plain text file 2014_10_12_000000_create_users_table.php Class Class source
  Accessible without login Plain text file 2014_10_12_100000_...rd_resets_table.php Class Class source
  Accessible without login Plain text file 2019_08_19_000000_...iled_jobs_table.php Class Class source
  Accessible without login Plain text file 2019_12_14_000001_...ss_tokens_table.php Class Class source
  Accessible without login Plain text file 2021_12_02_174733_..._payments_table.php Class Class source
  Accessible without login Plain text file 2021_12_02_175751_...e_wallets_table.php Class Class source
  Accessible without login Plain text file 2021_12_02_180154_...nsactions_table.php Class Class source
  Accessible without login Plain text file 2021_12_02_231608_...ansaction_table.php Class Class source
  Accessible without login Plain text file 2021_12_02_234650_...urrencies_table.php Class Class source
  Accessible without login Plain text file 2021_12_02_234755_...ansaction_table.php Class Class source
  Accessible without login Plain text file 2021_12_05_041427_..._payments_table.php Class Class source

  Files folder image Files  /  server  /  database  /  seeders  
File Role Description
  Accessible without login Plain text file AdminSeeder.php Class Class source
  Accessible without login Plain text file DatabaseSeeder.php Class Class source
  Accessible without login Plain text file PaymentSeeder.php Class Class source

  Files folder image Files  /  server  /  public  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Class Class source
  Accessible without login Plain text file robots.txt Doc. Documentation
  Accessible without login Plain text file web.config Data Auxiliary data

  Files folder image Files  /  server  /  resources  
File Role Description
Files folder imagejs (2 files)
Files folder imagelang (1 directory)
Files folder imageviews (1 file)

  Files folder image Files  /  server  /  resources  /  js  
File Role Description
  Accessible without login Plain text file app.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.js Data Auxiliary data

  Files folder image Files  /  server  /  resources  /  lang  
File Role Description
Files folder imageen (4 files)

  Files folder image Files  /  server  /  resources  /  lang  /  en  
File Role Description
  Accessible without login Plain text file auth.php Aux. Auxiliary script
  Accessible without login Plain text file pagination.php Aux. Auxiliary script
  Accessible without login Plain text file passwords.php Aux. Auxiliary script
  Accessible without login Plain text file validation.php Aux. Auxiliary script

  Files folder image Files  /  server  /  resources  /  views  
File Role Description
  Accessible without login Plain text file welcome.blade.php Aux. Auxiliary script

  Files folder image Files  /  server  /  routes  
File Role Description
  Accessible without login Plain text file api.php Class Class source
  Accessible without login Plain text file channels.php Example Example script
  Accessible without login Plain text file console.php Example Example script
  Accessible without login Plain text file web.php Aux. Auxiliary script

  Files folder image Files  /  server  /  tests  
File Role Description
Files folder imageFeature (1 file)
Files folder imageUnit (1 file)
  Accessible without login Plain text file CreatesApplication.php Class Class source
  Accessible without login Plain text file TestCase.php Class Class source

  Files folder image Files  /  server  /  tests  /  Feature  
File Role Description
  Accessible without login Plain text file ExampleTest.php Class Class source

  Files folder image Files  /  server  /  tests  /  Unit  
File Role Description
  Accessible without login Plain text file ExampleTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:65
This week:0
All time:10,131
This week:189Up