diff --git a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php index 975170f72..a61a3257b 100644 --- a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php +++ b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php @@ -35,7 +35,9 @@ class ApiWrapper public function __construct(private $clientId, private $clientSecret, private readonly ChillRedis $redis) { $this->client = new Client([ - 'base_uri' => 'https://entreprise.pole-emploi.fr/connexion/oauth2/access_token', +// 'base_uri' => 'https://entreprise.pole-emploi.fr/connexion/oauth2/access_token', + 'base_uri' => 'https://francetravail.io/connexion/oauth2/access_token', + ]); } @@ -49,20 +51,19 @@ class ApiWrapper return $data->access_token; } + try { $response = $this->client->post('', [ 'query' => ['realm' => '/partenaire'], 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded', ], - // 'body' => 'grant_type=client_credentials&client_id=PAR_chillcsconnectesdev_0e20082886f1bc5d8ff4f8b34868603e2bcc7ed6bc5963e648e3709c639aced9&client_secret=4e626fa3123bcf4d299591c09731fa3242a7e75bbc003955f903aebc33cdd022&scope=api_romev1%20nomenclatureRome%20application_PAR_chillcsconnectesdev_0e20082886f1bc5d8ff4f8b34868603e2bcc7ed6bc5963e648e3709c639aced9' 'form_params' => [ 'grant_type' => 'client_credentials', 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, 'scope' => \implode(' ', \array_merge($scopes, ['application_'.$this->clientId])), ], - // ]); ]); } catch (ClientException $e) { dump($e->getResponse()); diff --git a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php index 4a30432c9..6ece2afbe 100644 --- a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php +++ b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php @@ -44,14 +44,14 @@ class PartenaireRomeAppellation $this->wrapper = $wrapper; $this->logger = $logger; $this->client = new Client([ - 'base_uri' => 'https://api.emploi-store.fr/partenaire/rome/v1/', + 'base_uri' => 'https://api.francetravail.io/partenaire/rome-metiers', ]); } private function getBearer() { return $this->wrapper->getPublicBearer([ - 'api_romev1', + 'api_rome-metiersv1', 'nomenclatureRome', ]); } @@ -67,7 +67,7 @@ class PartenaireRomeAppellation $parameters = [ 'query' => [ 'q' => $search, - 'qf' => 'libelle', + 'fq' => 'libelle', ], 'headers' => [ 'Authorization' => 'Bearer '.$bearer, diff --git a/src/Bundle/ChillFranceTravailApiBundle/src/Resources/config/services.yml b/src/Bundle/ChillFranceTravailApiBundle/src/Resources/config/services.yml index 1c4fca21e..2bb364f7a 100644 --- a/src/Bundle/ChillFranceTravailApiBundle/src/Resources/config/services.yml +++ b/src/Bundle/ChillFranceTravailApiBundle/src/Resources/config/services.yml @@ -9,6 +9,6 @@ services: $logger: '@Psr\Log\LoggerInterface' Chill\FranceTravailApiBundle\Controller\RomeController: - arguments: - $apiAppellation: '@Chill\FranceTravailApiBundle\ApiHelper\PartenaireRomeAppellation' + autowire: true + autoconfigure: true tags: ['controller.service_arguments'] diff --git a/src/Bundle/ChillJobBundle/src/Form/Type/PickRomeAppellationType.php b/src/Bundle/ChillJobBundle/src/Form/Type/PickRomeAppellationType.php index da538f649..6ae77ba62 100644 --- a/src/Bundle/ChillJobBundle/src/Form/Type/PickRomeAppellationType.php +++ b/src/Bundle/ChillJobBundle/src/Form/Type/PickRomeAppellationType.php @@ -107,7 +107,7 @@ class PickRomeAppellationType extends AbstractType $view->vars['attr']['data-rome-appellation-picker'] = true; $view->vars['attr']['data-select-interactive-loading'] = true; $view->vars['attr']['data-search-url'] = $this->urlGenerator - ->generate('chill_pole_emploi_api_appellation_search', ['_format' => 'json']); + ->generate('chill_france_travail_api_appellation_search', ['_format' => 'json']); $view->vars['attr']['data-placeholder'] = 'Choisir une appellation'; $view->vars['attr']['data-no-results-label'] = $this->translator->trans('select2.no_results'); $view->vars['attr']['data-error-load-label'] = $this->translator->trans('select2.error_loading');