singleloginsystem/app/Services/Keka/KekaConfigResolver.php
= c4e2cfc4bb Feat: Modularize Keka HR integration with services
- Introduced `KekaAccessGuard`, `KekaConfigResolver`, `KekaIntegrationService`, `KekaTokenService`, and `KekaUrlBuilder` to streamline Keka HR functionality.
- Refactored `KekaController` to delegate key operations to modular services, improving maintainability.
- Updated dashboard UI to ensure alignment with the new service-based architecture.
- Enhanced error handling, logging, and code reusability for Keka integration workflows.
2026-06-12 11:55:12 +00:00

59 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\Keka;
use App\Models\ConnectedApp;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class KekaConfigResolver
{
private const PROVIDER_SLUG = 'keka-hr';
private const DEFAULT_KEKA_URL = 'https://sentientgeeks.keka.com';
private const DEFAULT_PROVIDER = 'Office365';
private const DEFAULT_CALLBACK_PATH = 'signin-oidc';
public function getApp(): ConnectedApp
{
$app = ConnectedApp::whereHas('provider', function ($query): void {
$query->where('slug', self::PROVIDER_SLUG);
})->first();
if (! $app) {
throw new NotFoundHttpException('Keka HR app registration not found.');
}
return $app;
}
public function getKekaUrl(ConnectedApp $app): string
{
return (string) (
data_get($app->settings, 'keka.keka_url')
?? data_get($app->settings, 'keka_url')
?? self::DEFAULT_KEKA_URL
);
}
public function getProvider(ConnectedApp $app): string
{
return (string) (
data_get($app->settings, 'keka.provider')
?? data_get($app->settings, 'provider')
?? self::DEFAULT_PROVIDER
);
}
public function getCallbackPath(ConnectedApp $app): string
{
return (string) (
data_get($app->settings, 'keka.callback_path')
?? self::DEFAULT_CALLBACK_PATH
);
}
}