- Add Enums: TransactionType, TransactionStatus, PaymentGateway - Migrations: wallets, wallet_transactions, wallet_activity_logs - Models: Wallet, WalletTransaction, WalletActivityLog - Services: WalletService with complete business logic - Controllers: WalletController, PaymentController - Filament Resources: WalletResource, WalletTransactionResource - Artisan Command: ifnex:token for API token generation - Sanctum integration with statefulApi and exception handling - Full API endpoints: balance, transactions, admin-adjust, freeze/unfreeze
31 lines
838 B
PHP
31 lines
838 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
enum TransactionStatus: string
|
|
{
|
|
case PENDING = 'pending'; // در انتظار تأیید درگاه
|
|
case COMPLETED = 'completed'; // موفق
|
|
case FAILED = 'failed'; // ناموفق
|
|
case REFUNDED = 'refunded'; // بازگشت داده شده
|
|
|
|
public function label(): string
|
|
{
|
|
return match($this) {
|
|
self::PENDING => 'در انتظار',
|
|
self::COMPLETED => 'موفق',
|
|
self::FAILED => 'ناموفق',
|
|
self::REFUNDED => 'بازگشت شده',
|
|
};
|
|
}
|
|
|
|
public function color(): string
|
|
{
|
|
return match($this) {
|
|
self::PENDING => 'warning',
|
|
self::COMPLETED => 'success',
|
|
self::FAILED => 'danger',
|
|
self::REFUNDED => 'info',
|
|
};
|
|
}
|
|
} |