> */ public function drivers(): array { return [ self::PROVIDER_MONTIFY => MontifyPartnerGateway::class, // مثال آینده: // self::PROVIDER_PAYPING => PaypingDirectGateway::class, ]; } public function configuredProvider(): string { $provider = strtolower($this->config->getString('wallet_payment_provider', '')); if ($provider !== '' && $provider !== self::PROVIDER_NONE) { return $provider; } // سازگاری با سوییچ قدیمی external_payment_enabled if ($this->config->getBool('external_payment_enabled', false)) { return self::PROVIDER_MONTIFY; } return self::PROVIDER_NONE; } public function resolve(?string $provider = null): ?WalletPaymentGatewayInterface { $key = strtolower($provider ?: $this->configuredProvider()); if ($key === '' || $key === self::PROVIDER_NONE) { return null; } $drivers = $this->drivers(); if (!isset($drivers[$key])) { return null; } return app($drivers[$key]); } public function resolveOrFail(?string $provider = null): WalletPaymentGatewayInterface { $gateway = $this->resolve($provider); if (!$gateway) { throw new InvalidArgumentException('درگاه پرداخت پیکربندی نشده است'); } return $gateway; } /** فقط برای UI کلاینت — بدون افشای نوع/credential */ public function isOnlineDepositAvailable(): bool { $gateway = $this->resolve(); return $gateway !== null && $gateway->isAvailable(); } /** * @return array{online_enabled: bool} */ public function publicOptions(): array { return [ 'online_enabled' => $this->isOnlineDepositAvailable(), ]; } }