Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ permissions:
contents: read

jobs:
check-cs:
coding-style:
name: Coding Style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
with:
args: --config=.php-cs-fixer.php --diff --dry-run
coverage: "none"
extensions: intl, ctype, iconv
php-version: 8.2
tools: composer

- name: "Composer install"
uses: ramsey/composer-install@v4
with:
working-directory: "tools/php-cs-fixer"

- name: "PHP-CS-Fixer"
run: ./tools/bin/php-cs-fixer check
20 changes: 19 additions & 1 deletion .github/workflows/diff-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ jobs:
- name: Checkout
uses: actions/checkout@v7

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: intl, ctype, iconv
php-version: 8.2
tools: composer

- name: "Composer install (rector)"
uses: ramsey/composer-install@v4
with:
working-directory: "tools/php-cs-fixer"

- name: "Composer install (php-cs-fixer)"
uses: ramsey/composer-install@v4
with:
working-directory: "tools/php-cs-fixer"

- name: Install dependencies
run: composer update --no-interaction

Expand All @@ -26,7 +44,7 @@ jobs:
run: ./tools/bin/rector

- name: Code style
run: PHP_CS_FIXER_IGNORE_ENV=1 ./tools/bin/php-cs-fixer fix
run: ./tools/bin/php-cs-fixer fix

- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
2 changes: 1 addition & 1 deletion .jane-openapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

return [
'openapi-file' => 'https://www.pappers.fr/api_v2.yaml',
'openapi-file' => 'openapi.json',
'namespace' => 'Qdequippe\Pappers\Api',
'directory' => __DIR__ . '/generated/',
'strict' => false,
Expand Down
1 change: 0 additions & 1 deletion .php-version

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
],
"minimum-stability": "stable",
"require": {
"php": ">=8.1",
"php": ">=8.2",
"jane-php/open-api-runtime": "^7.4"
},
"require-dev": {
Expand Down
536 changes: 419 additions & 117 deletions generated/Client.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/Endpoint/Association.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function transformResponseBody(ResponseInterface $response, Serializer
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
if ((null === $contentType) === false && (200 === $status && false !== stripos(strtolower($contentType), 'application/json'))) {
return $serializer->deserialize($body, 'Qdequippe\Pappers\Api\Model\Association', 'json');
}
if (400 === $status) {
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/Cartographie.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function transformResponseBody(ResponseInterface $response, Serializer
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
if ((null === $contentType) === false && (200 === $status && false !== stripos(strtolower($contentType), 'application/json'))) {
return $serializer->deserialize($body, 'Qdequippe\Pappers\Api\Model\Cartographie', 'json');
}
if (400 === $status) {
Expand Down
9 changes: 7 additions & 2 deletions generated/Endpoint/ComptesAnnuels.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Qdequippe\Pappers\Api\Endpoint;

use Jane\Component\JsonSchemaRuntime\Exception\MalformedJsonException;
use Psr\Http\Message\ResponseInterface;
use Qdequippe\Pappers\Api\Exception\ComptesAnnuelsBadRequestException;
use Qdequippe\Pappers\Api\Exception\ComptesAnnuelsNotFoundException;
Expand Down Expand Up @@ -72,8 +73,12 @@ protected function transformResponseBody(ResponseInterface $response, Serializer
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
return json_decode($body);
if ((null === $contentType) === false && (200 === $status && false !== stripos(strtolower($contentType), 'application/json'))) {
try {
return json_decode($body, false, 512, \JSON_THROW_ON_ERROR);
} catch (\JsonException $jsonException) {
throw new MalformedJsonException('Malformed JSON response body.', 0, $jsonException);
}
}
if (400 === $status) {
throw new ComptesAnnuelsBadRequestException($response);
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/Conformite.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function transformResponseBody(ResponseInterface $response, Serializer
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
if ((null === $contentType) === false && (200 === $status && false !== stripos(strtolower($contentType), 'application/json'))) {
return $serializer->deserialize($body, 'Qdequippe\Pappers\Api\Model\ConformitePersonnePhysiqueGetResponse200', 'json');
}
if (400 === $status) {
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentAvisSituationInsee.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentAvisSituationInseeNotFoundException
* @throws DocumentAvisSituationInseeServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentBeneficiairesEffectifs.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentBeneficiairesEffectifsNotFoundException
* @throws DocumentBeneficiairesEffectifsServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentExtraitInpi.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentExtraitInpiNotFoundException
* @throws DocumentExtraitInpiServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentExtraitPappers.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentExtraitPappersNotFoundException
* @throws DocumentExtraitPappersServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentScoringFinancier.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentScoringFinancierNotFoundException
* @throws DocumentScoringFinancierServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentScoringNonFinancier.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentScoringNonFinancierNotFoundException
* @throws DocumentScoringNonFinancierServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentStatusNotFoundException
* @throws DocumentStatusServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/DocumentTelechargement.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
* @throws DocumentTelechargementNotFoundException
* @throws DocumentTelechargementServiceUnavailableException
*/
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null): void
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
Expand Down
16 changes: 13 additions & 3 deletions generated/Endpoint/Entreprise.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class Entreprise extends BaseEndpoint implements Endpoint
* > Ce statut est signalé par le champ `diffusable=false`.
* >
* > Les champs suivants peuvent alors devenir nullable : `nom_entreprise` ; `denomination` ; `nom` ; `prenom` ; `sexe` ; `nom_usage` ; `nom_patronymique` ; `code_postal` ; `numero_voie` ; `indice_repetition` ; `type_voie` ; `libelle_voie` ; `complement_adresse` ; `adresse_ligne_1` ; `adresse_ligne_2`.
* >
* > D'autre part, certaines rares entreprises ne sont pas connues par l'INSEE.
* >
* > En utilisant le paramètre `autoriser_absence_insee=true`, la requête retournera également ces entreprises.
* >
* > Les champs suivants peuvent alors devenir nullable : `categorie_juridique` ; `siege`.
*
* @param array{
* "siren"?: string, //SIREN de l'entreprise
Expand All @@ -37,6 +43,7 @@ class Entreprise extends BaseEndpoint implements Endpoint
* "validite_tva_intracommunautaire"?: bool, //Si vrai, le champ validite_tva_intracommunautaire du retour indiquera si le numéro de tva est valide auprès de la Commission européenne. Valeur par défaut : `false`.
* "publications_bodacc_brutes"?: bool, //Pappers traite les publications BODACC afin de supprimer les publications périmée. Si vrai, le retour inclura les publications bodacc sans traitement. Valeur par défaut : `false`.
* "beneficiaires_effectifs_complets"?: bool, //Si vrai, la requête se lancera avec un accès complet au registre des bénéficiaires effectifs. Nécessite une habilitation.
* "autoriser_absence_insee"?: bool, //Si vrai, la requête retournera également les entreprises qui ne sont pas connues par l'INSEE (cas rares). Sans ce paramètre, ces entreprises retournent une erreur 404. Lorsque ce paramètre est à vrai, les champs `categorie_juridique` et `siege` peuvent être nuls.
* "champs_supplementaires"?: string, //Liste des champs supplémentaires à inclure dans le retour. Certains champs peuvent entraîner une consommation de crédits supplémentaires.
*
* Champs supplémentaires disponibles :
Expand All @@ -56,6 +63,7 @@ class Entreprise extends BaseEndpoint implements Endpoint
* - `code_departement` : gratuit
* - `departement` : gratuit
* - `nomenclature_code_naf` : gratuit
* - `lien_pappers` : gratuit
* - `labels` : gratuit
* - `labels:orias` : 0.5 crédit supplémentaire
* - `labels:cci` : 0.5 crédit supplémentaire
Expand All @@ -79,6 +87,7 @@ class Entreprise extends BaseEndpoint implements Endpoint
* - `informations_boursieres`: 5 crédits supplémentaires si disponible
* - `informations_boursieres:documents`: 10 crédits supplémentaires si disponible (donc un total de 15 crédits supplémentaires car ce champ inclut également le champ `informations_boursieres`)
* - `finances_estimations` : 5 crédits supplémentaires si disponible
* - `actif_net_inferieur_moitie_capital`: 1 crédit supplémentaire
* } $queryParameters
*/
public function __construct(array $queryParameters = [])
Expand Down Expand Up @@ -109,7 +118,7 @@ public function getExtraHeaders(): array
protected function getQueryOptionsResolver(): OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(['siren', 'siret', 'format_publications_bodacc', 'validite_tva_intracommunautaire', 'publications_bodacc_brutes', 'beneficiaires_effectifs_complets', 'champs_supplementaires']);
$optionsResolver->setDefined(['siren', 'siret', 'format_publications_bodacc', 'validite_tva_intracommunautaire', 'publications_bodacc_brutes', 'beneficiaires_effectifs_complets', 'autoriser_absence_insee', 'champs_supplementaires']);
$optionsResolver->setRequired([]);
$optionsResolver->setDefaults([]);
$optionsResolver->addAllowedTypes('siren', ['string']);
Expand All @@ -118,6 +127,7 @@ protected function getQueryOptionsResolver(): OptionsResolver
$optionsResolver->addAllowedTypes('validite_tva_intracommunautaire', ['bool']);
$optionsResolver->addAllowedTypes('publications_bodacc_brutes', ['bool']);
$optionsResolver->addAllowedTypes('beneficiaires_effectifs_complets', ['bool']);
$optionsResolver->addAllowedTypes('autoriser_absence_insee', ['bool']);
$optionsResolver->addAllowedTypes('champs_supplementaires', ['string']);

return $optionsResolver;
Expand All @@ -134,10 +144,10 @@ protected function transformResponseBody(ResponseInterface $response, Serializer
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
if ((null === $contentType) === false && (200 === $status && false !== stripos(strtolower($contentType), 'application/json'))) {
return $serializer->deserialize($body, 'Qdequippe\Pappers\Api\Model\EntrepriseFiche', 'json');
}
if ((null === $contentType) === false && (206 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
if ((null === $contentType) === false && (206 === $status && false !== stripos(strtolower($contentType), 'application/json'))) {
return $serializer->deserialize($body, 'Qdequippe\Pappers\Api\Model\EntrepriseFiche', 'json');
}
if (400 === $status) {
Expand Down
Loading
Loading