Feat add payment with gateway of montify
This commit is contained in:
@@ -42,6 +42,65 @@ class Setting extends Model
|
||||
return $cols;
|
||||
}
|
||||
|
||||
/**
|
||||
* کلیدهایی که هرگز نباید در پاسخ عمومی api/get_settings برگردند.
|
||||
* credential درگاه، توکنها، رمزها و پیکربندی داخلی پرداخت.
|
||||
*/
|
||||
public static function isSecretOrServerOnlyKey(string $key): bool
|
||||
{
|
||||
$key = strtolower(trim($key));
|
||||
if ($key === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// کل گروه پیکربندی پرداخت آنلاین — فقط سرور / ادمین
|
||||
if (
|
||||
str_starts_with($key, 'external_payment_')
|
||||
|| $key === 'wallet_payment_provider'
|
||||
|| str_starts_with($key, 'payping_')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$exact = [
|
||||
'node_client_id',
|
||||
'node_shared_secret',
|
||||
'montzar_password',
|
||||
'montzar_token',
|
||||
'montzar_mobile',
|
||||
'bale_bot_token',
|
||||
'telegram_bot_token',
|
||||
'rubika_bot_token',
|
||||
'tahesab_token',
|
||||
'tahesab_host',
|
||||
'tahesab_port',
|
||||
'tahesab_db',
|
||||
'pargar_password',
|
||||
'pargar_api_token',
|
||||
'pargar_username',
|
||||
'zarin_api',
|
||||
'zarin_token',
|
||||
];
|
||||
if (in_array($key, $exact, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (bool) preg_match('/(^|_)(secret|password|token|api_key|apikey|private)(_|$)/', $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* فیلتر تنظیمات برای پاسخ عمومی (اپ کاربر).
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|iterable $settings
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public static function forPublicApi($settings)
|
||||
{
|
||||
return collect($settings)
|
||||
->filter(fn ($row) => ! static::isSecretOrServerOnlyKey((string) (is_array($row) ? ($row['key'] ?? '') : ($row->key ?? ''))))
|
||||
->values();
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'key',
|
||||
'title_fa',
|
||||
|
||||
Reference in New Issue
Block a user