- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees) - Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue) - Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts - Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs - Remove legacy and dead CSV employee import/export code - Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation - Add comprehensive Pest unit, integration, and feature test coverage
64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use GuzzleHttp\Psr7\Uri;
|
|
use Illuminate\Foundation\Application;
|
|
use Illuminate\Support\Facades\Config;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Psr\Log\LoggerInterface;
|
|
use Uwil\ArcadiaApiPhpClient\ArcadiaApiClient;
|
|
use Uwil\ArcadiaApiPhpClient\Auth\ClientIdentifier;
|
|
use Uwil\ArcadiaApiPhpClient\Auth\ClientSecret;
|
|
use Uwil\ArcadiaApiPhpClient\Lib\ApiConfig;
|
|
use Uwil\ArcadiaApiPhpClient\Service\EmployeeService as LibEmployeeService;
|
|
|
|
class ArcadiaApiProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
#[\Override]
|
|
public function register()
|
|
{
|
|
$this->app->singleton(
|
|
ApiConfig::class,
|
|
fn (Application $app) => $this->apiConfig($app->make(LoggerInterface::class))
|
|
);
|
|
$this->app->singleton(
|
|
LibEmployeeService::class,
|
|
fn (Application $app) => $app->make(ArcadiaApiClient::class)->employees()
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
}
|
|
|
|
private function apiConfig(LoggerInterface $logger): ApiConfig
|
|
{
|
|
$endpoint = new Uri(Config::string('services.arcadia_api.endpoint'));
|
|
$clientIdentifier = new ClientIdentifier(
|
|
Config::string('services.arcadia_api.api_key')
|
|
);
|
|
$clientSecret = new ClientSecret(
|
|
Config::string('services.arcadia_api.api_secret')
|
|
);
|
|
|
|
return new ApiConfig(
|
|
endpoint: $endpoint,
|
|
apiKey: $clientIdentifier,
|
|
secret: $clientSecret,
|
|
logger: $logger
|
|
);
|
|
}
|
|
}
|