Deploy Ladill POS / deploy (push) Successful in 37s
Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PaymentGatewaySetting extends Model
|
|
{
|
|
public const PROVIDER_PAYSTACK = 'paystack';
|
|
|
|
public const PROVIDER_FLUTTERWAVE = 'flutterwave';
|
|
|
|
public const PROVIDER_HUBTEL = 'hubtel';
|
|
|
|
protected $fillable = [
|
|
'owner_ref',
|
|
'provider',
|
|
'public_key',
|
|
'secret_key',
|
|
'webhook_secret',
|
|
'is_active',
|
|
'metadata',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'public_key' => 'encrypted',
|
|
'secret_key' => 'encrypted',
|
|
'webhook_secret' => 'encrypted',
|
|
'is_active' => 'boolean',
|
|
'metadata' => 'array',
|
|
];
|
|
}
|
|
|
|
public function isConfigured(): bool
|
|
{
|
|
if (! $this->is_active) {
|
|
return false;
|
|
}
|
|
|
|
$public = trim((string) $this->public_key);
|
|
$secret = trim((string) $this->secret_key);
|
|
|
|
return match ($this->provider) {
|
|
self::PROVIDER_PAYSTACK => str_starts_with($public, 'pk_') && str_starts_with($secret, 'sk_'),
|
|
self::PROVIDER_FLUTTERWAVE => $public !== '' && $secret !== '',
|
|
self::PROVIDER_HUBTEL => $public !== '' && $secret !== '',
|
|
default => false,
|
|
};
|
|
}
|
|
}
|