Initial commit - WASL Digital Wallet

This commit is contained in:
Hamza-Ayed
2026-06-20 21:55:06 +03:00
commit 7306c47368
61 changed files with 4157 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Enums;
enum WalletStatus: string
{
case ACTIVE = 'active';
case FROZEN = 'frozen';
case CLOSED = 'closed';
public function canReceive(): bool
{
return $this === self::ACTIVE;
}
public function canSend(): bool
{
return $this === self::ACTIVE;
}
}
enum EntryType: string
{
case DEBIT = 'debit';
case CREDIT = 'credit';
}
enum OtpPurpose: string
{
case REGISTRATION = 'registration';
case LOGIN = 'login';
case TRANSFER = 'transfer';
case PIN_CHANGE = 'pin_change';
case PHONE_CHANGE = 'phone_change';
case KYC = 'kyc';
}
enum OtpChannel: string
{
case SMS = 'sms';
case AUTHENTICATOR = 'authenticator';
}
enum FraudAction: string
{
case BLOCKED = 'blocked';
case REVIEWED = 'reviewed';
case ALLOWED = 'allowed';
}
enum FraudStatus: string
{
case OPEN = 'open';
case INVESTIGATED = 'investigated';
case CLOSED = 'closed';
}
enum DevicePlatform: string
{
case ANDROID = 'android';
case IOS = 'ios';
}
enum KycDocType: string
{
case NATIONAL_ID = 'national_id';
case PASSPORT = 'passport';
case UTILITY_BILL = 'utility_bill';
case SELFIE = 'selfie';
}
enum KycDocStatus: string
{
case PENDING = 'pending';
case APPROVED = 'approved';
case REJECTED = 'rejected';
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Enums;
enum KycLevel: int
{
case NONE = 0; // No KYC — cannot transact
case PHONE = 1; // Phone verified — limited
case ID = 2; // National ID verified — standard
case FULL = 3; // Full KYC (ID + address proof) — unlimited
public function label(): string
{
return match ($this) {
self::NONE => __('kyc.none'),
self::PHONE => __('kyc.phone'),
self::ID => __('kyc.id'),
self::FULL => __('kyc.full'),
};
}
public function limits(): array
{
return config("wasl.wallet.limits.{$this->value}", []);
}
public function maxBalanceMinor(): int
{
return $this->limits()['balance'] ?? 0;
}
public function dailyTxLimitMinor(): int
{
return $this->limits()['daily_tx'] ?? 0;
}
public function monthlyTxLimitMinor(): int
{
return $this->limits()['monthly_tx'] ?? 0;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Enums;
enum TransactionType: string
{
case TRANSFER = 'transfer';
case DEPOSIT = 'deposit';
case WITHDRAW = 'withdraw';
case MERCHANT_PAY = 'merchant_pay';
case REFUND = 'refund';
case FEE = 'fee';
}
enum TransactionStatus: string
{
case PENDING = 'pending';
case PROCESSING = 'processing';
case COMPLETED = 'completed';
case FAILED = 'failed';
case REVERSED = 'reversed';
public function isFinal(): bool
{
return in_array($this, [self::COMPLETED, self::FAILED, self::REVERSED]);
}
public function canTransitionTo(self $new): bool
{
return match ($this) {
self::PENDING => in_array($new, [self::PROCESSING, self::COMPLETED, self::FAILED]),
self::PROCESSING => in_array($new, [self::COMPLETED, self::FAILED]),
self::COMPLETED => in_array($new, [self::REVERSED]),
default => false,
};
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Enums;
enum UserStatus: string
{
case PENDING = 'pending';
case ACTIVE = 'active';
case SUSPENDED = 'suspended';
case BANNED = 'banned';
public function label(): string
{
return match ($this) {
self::PENDING => __('status.pending'),
self::ACTIVE => __('status.active'),
self::SUSPENDED => __('status.suspended'),
self::BANNED => __('status.banned'),
};
}
public function canAuthenticate(): bool
{
return in_array($this, [self::ACTIVE, self::SUSPENDED]);
}
}