How arguv/laravel-wallet-service works
Wallet service accepts REST requests from users and gRPC calls from internal services, then exposes wallet creation, deposits, transfers, balances, transaction lookups, and history. Transfer processing applies ledger rules and idempotency before recording postings and updating wallet state in PostgreSQL; audit is also persisted. The README documents these capabilities and the application/storage-port boundary. Some routes and unsampled subsystems are represented at directory or module level; their internal wiring is omitted where the excerpts do not establish it.
Main entry points: TransferMoney.php Transfer operation · Queries Ledger queries · WalletRepository.php Wallet repository · TransferController.php Transfer API
Components 24
Client interfaces
- Wallet API
app/Http/Controllers/Api/V1/WalletController.php - Deposit API
app/Http/Controllers/Api/V1/DepositController.php - Transfer API
app/Http/Controllers/Api/V1/TransferController.php - History API
app/Http/Controllers/Api/V1/WalletHistoryController.php - Ledger gRPC
app/Grpc/LedgerService.php
Application services
- Wallet operations
app/Application/UseCases/CreateWallet.php - Deposit operation
app/Application/UseCases/Deposit.php - Transfer operation
app/Application/UseCases/TransferMoney.php - Ledger queries
app/Application/Queries - Idempotent execution
app/Application/Idempotency/IdempotentExecutor.php - Audit recording
app/Application/Audit/RecordAudit.php - Wallet repository
app/Application/Ports/WalletRepository.php - Ledger repository
app/Application/Ports/LedgerRepository.php
Ledger domain
- Wallet rules
app/Domain/Wallet/Wallet.php - Money and currency
app/Domain/Money/Money.php - Ledger postings
app/Domain/Ledger/Posting.php
Persistence and operations
- Wallet persistence
app/Infrastructure/Persistence/EloquentWalletRepository.php - Ledger persistence
app/Infrastructure/Persistence/EloquentLedgerRepository.php - Audit persistence
app/Infrastructure/Persistence/DbAuditWriter.php - Idempotency persistence
app/Infrastructure/Persistence/PostgresIdempotencyStore.php - PostgreSQL
- Transfer rate limiting
app/Infrastructure/Redis/FixedWindowCounter.php
Other components
- REST clients
- Internal services
Connections 31
- REST clients → Transfer API: submits REST
README.md - REST clients → Wallet API: requests REST
README.md - REST clients → Deposit API: submits REST
README.md - REST clients → History API: requests history
README.md - Internal services → Ledger gRPC: calls gRPC
README.md - Transfer API → Transfer operation: calls
app/Http/Controllers/Api/V1/TransferController.php - Transfer API → Ledger queries: looks up transfer
app/Http/Controllers/Api/V1/TransferController.php - Wallet API → Wallet operations: creates wallet
app/Http/Controllers/Api/V1/WalletController.php - Wallet API → Ledger queries: reads wallets
app/Http/Controllers/Api/V1/WalletController.php - Deposit API → Deposit operation: calls
app/Http/Controllers/Api/V1/DepositController.php - Ledger gRPC → Transfer operation: calls
app/Grpc/LedgerService.php - Ledger gRPC → Ledger queries: reads ledger
app/Grpc/LedgerService.php - Transfer operation → Idempotent execution: executes idempotently
app/Application/UseCases/TransferMoney.php - Transfer operation → Wallet repository: uses wallet port
app/Application/UseCases/TransferMoney.php - Transfer operation → Ledger repository: records transfer
app/Application/UseCases/TransferMoney.php - Transfer operation → Ledger postings: builds postings
app/Application/UseCases/TransferMoney.php - Transfer operation → Money and currency: validates amounts
app/Application/UseCases/TransferMoney.php - Transfer operation → Wallet rules: checks wallets
app/Application/UseCases/TransferMoney.php - Wallet operations → Wallet repository: uses wallet port
app/Application/UseCases/CreateWallet.php - Deposit operation → Wallet repository: uses wallet port
app/Application/UseCases/Deposit.php - Ledger queries → Ledger repository: reads ledger
- Ledger queries → Wallet repository: reads wallets
- Idempotent execution → Idempotency persistence: stores keys
- Idempotent execution → Audit recording: records audit
- Wallet repository → Wallet persistence: implemented by
app/Providers/LedgerServiceProvider.php - Ledger repository → Ledger persistence: implemented by
app/Providers/LedgerServiceProvider.php - Wallet persistence → PostgreSQL: reads and writes
app/Infrastructure/Persistence/EloquentWalletRepository.php - Ledger persistence → PostgreSQL: reads and writes
app/Infrastructure/Persistence/EloquentLedgerRepository.php - Audit persistence → PostgreSQL: writes audit
- Idempotency persistence → PostgreSQL: stores keys
- Transfer API → Transfer rate limiting: may be rate-limited