Add AST JSON representation for SiteConfigController.php with nodes and edges

This commit is contained in:
hamed
2026-07-02 10:16:40 +03:30
parent 70d280070b
commit 949fddc57a
16 changed files with 707 additions and 650 deletions
+15 -4
View File
@@ -180,7 +180,7 @@ class PaymentController extends BaseController
$gateway = $this->resolveGateway($gatewayName);
if ($gateway === null) {
return $this->error(ErrorCodes::ERR_VALIDATION_001, 'درگاه پرداخت نامعتبر است', 422, 'gateway');
return $this->error(ErrorCodes::ERR_VALIDATION_001, 'درگاه پرداخت نامعتبر یا غیرفعال است', 422, 'gateway');
}
if ($this->circuitBreaker->isOpen($gatewayName)) {
@@ -428,7 +428,7 @@ class PaymentController extends BaseController
$gateway = $this->resolveGateway($gatewayName);
if ($gateway === null) {
return $this->error(ErrorCodes::ERR_VALIDATION_001, 'درگاه پرداخت نامعتبر است', 422, 'gateway');
return $this->error(ErrorCodes::ERR_VALIDATION_001, 'درگاه پرداخت نامعتبر یا غیرفعال است', 422, 'gateway');
}
if ($this->circuitBreaker->isOpen($gatewayName)) {
@@ -567,8 +567,8 @@ class PaymentController extends BaseController
$labels = ['mellat' => 'بانک ملت', 'sep' => 'سپ (سامان کیش)'];
$gateways = [];
foreach ([$this->mellat, $this->sep] as $gateway) {
if ($gateway->isConfigured()) {
$name = $gateway->getName();
$name = $gateway->getName();
if ($gateway->isConfigured() && $this->isGatewayEnabled($name)) {
$gateways[] = ['name' => $name, 'label' => $labels[$name] ?? $name];
}
}
@@ -616,6 +616,10 @@ class PaymentController extends BaseController
return $this->mock;
}
if (!$this->isGatewayEnabled($name)) {
return null;
}
return match ($name) {
'mellat' => $this->mellat,
'sep' => $this->sep,
@@ -623,6 +627,13 @@ class PaymentController extends BaseController
};
}
/** آیا این درگاه در تنظیمات فعال است؟ کلید تنظیم‌نشده = فعال (سازگاری با نصب‌های قبلی). */
private function isGatewayEnabled(string $name): bool
{
$v = $this->configRepo->get($name . '_enabled');
return $v === null || $v === '1';
}
/** @return string[] allowed frontend hosts — from SiteConfig, falling back to env. */
private function allowedHosts(): array
{