-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[create-pull-request] automated change (#35)
- Loading branch information
1 parent
43c76e3
commit 31feef3
Showing
8 changed files
with
506 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Pappers\Api\Endpoint; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
use Qdequippe\Pappers\Api\Exception\ConformiteBadRequestException; | ||
use Qdequippe\Pappers\Api\Exception\ConformiteServiceUnavailableException; | ||
use Qdequippe\Pappers\Api\Exception\ConformiteUnauthorizedException; | ||
use Qdequippe\Pappers\Api\Model\ConformitePersonnePhysiqueGetResponse200; | ||
use Qdequippe\Pappers\Api\Runtime\Client\BaseEndpoint; | ||
use Qdequippe\Pappers\Api\Runtime\Client\Endpoint; | ||
use Qdequippe\Pappers\Api\Runtime\Client\EndpointTrait; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Component\Serializer\SerializerInterface; | ||
|
||
class Conformite extends BaseEndpoint implements Endpoint | ||
{ | ||
use EndpointTrait; | ||
|
||
/** | ||
* Cette route vérifie le statut de personne politiquement exposée et la présence de sanctions internationales pour une personne physique. | ||
* | ||
* Pour vérifier le statut de dirigeants et bénéficiaires effectifs d'entreprises, vous pouvez directement utiliser la route `/entreprise` avec les champs supplémentaires `personne_politiquement_exposee` et `sanctions`. | ||
* | ||
* @param array $queryParameters { | ||
* | ||
* @var string $api_token Clé d'utilisation de l'API | ||
* @var string $nom Nom de la personne physique | ||
* @var string $prenom Prénom de la personne physique | ||
* @var string $date_de_naissance Date de naissance de la personne physique, au format AAAA-MM-JJ ou AAAA-MM | ||
* } | ||
*/ | ||
public function __construct(array $queryParameters = []) | ||
{ | ||
$this->queryParameters = $queryParameters; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'GET'; | ||
} | ||
|
||
public function getUri(): string | ||
{ | ||
return '/conformite/personne_physique'; | ||
} | ||
|
||
public function getBody(SerializerInterface $serializer, $streamFactory = null): array | ||
{ | ||
return [[], null]; | ||
} | ||
|
||
public function getExtraHeaders(): array | ||
{ | ||
return ['Accept' => ['application/json']]; | ||
} | ||
|
||
protected function getQueryOptionsResolver(): OptionsResolver | ||
{ | ||
$optionsResolver = parent::getQueryOptionsResolver(); | ||
$optionsResolver->setDefined(['api_token', 'nom', 'prenom', 'date_de_naissance']); | ||
$optionsResolver->setRequired(['api_token', 'nom', 'prenom', 'date_de_naissance']); | ||
$optionsResolver->setDefaults([]); | ||
$optionsResolver->addAllowedTypes('api_token', ['string']); | ||
$optionsResolver->addAllowedTypes('nom', ['string']); | ||
$optionsResolver->addAllowedTypes('prenom', ['string']); | ||
$optionsResolver->addAllowedTypes('date_de_naissance', ['string']); | ||
|
||
return $optionsResolver; | ||
} | ||
|
||
/** | ||
* @return ConformitePersonnePhysiqueGetResponse200|null | ||
* | ||
* @throws ConformiteBadRequestException | ||
* @throws ConformiteUnauthorizedException | ||
* @throws ConformiteServiceUnavailableException | ||
*/ | ||
protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) | ||
{ | ||
$status = $response->getStatusCode(); | ||
$body = (string) $response->getBody(); | ||
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos($contentType, 'application/json'))) { | ||
return $serializer->deserialize($body, 'Qdequippe\\Pappers\\Api\\Model\\ConformitePersonnePhysiqueGetResponse200', 'json'); | ||
} | ||
if (400 === $status) { | ||
throw new ConformiteBadRequestException($response); | ||
} | ||
if (401 === $status) { | ||
throw new ConformiteUnauthorizedException($response); | ||
} | ||
if (503 === $status) { | ||
throw new ConformiteServiceUnavailableException($response); | ||
} | ||
} | ||
|
||
public function getAuthenticationScopes(): array | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Pappers\Api\Exception; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class ConformiteBadRequestException extends BadRequestException | ||
{ | ||
/** | ||
* @var ResponseInterface | ||
*/ | ||
private $response; | ||
|
||
public function __construct(?ResponseInterface $response = null) | ||
{ | ||
parent::__construct('Paramètres de la requête incorrects.'); | ||
$this->response = $response; | ||
} | ||
|
||
public function getResponse(): ?ResponseInterface | ||
{ | ||
return $this->response; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
generated/Exception/ConformiteServiceUnavailableException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Pappers\Api\Exception; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class ConformiteServiceUnavailableException extends ServiceUnavailableException | ||
{ | ||
/** | ||
* @var ResponseInterface | ||
*/ | ||
private $response; | ||
|
||
public function __construct(?ResponseInterface $response = null) | ||
{ | ||
parent::__construct('Erreur interne. La personne physique n\'a pas pu être vérifiée.'); | ||
$this->response = $response; | ||
} | ||
|
||
public function getResponse(): ?ResponseInterface | ||
{ | ||
return $this->response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Pappers\Api\Exception; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class ConformiteUnauthorizedException extends UnauthorizedException | ||
{ | ||
/** | ||
* @var ResponseInterface | ||
*/ | ||
private $response; | ||
|
||
public function __construct(?ResponseInterface $response = null) | ||
{ | ||
parent::__construct('Clé API incorrecte.'); | ||
$this->response = $response; | ||
} | ||
|
||
public function getResponse(): ?ResponseInterface | ||
{ | ||
return $this->response; | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
generated/Model/ConformitePersonnePhysiqueGetResponse200.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Pappers\Api\Model; | ||
|
||
class ConformitePersonnePhysiqueGetResponse200 extends \ArrayObject | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $initialized = []; | ||
|
||
public function isInitialized($property): bool | ||
{ | ||
return \array_key_exists($property, $this->initialized); | ||
} | ||
/** | ||
* Informations sur le statut de personne politiquement exposée. Uniquement présent si demandé dans les champs supplémentaires. | ||
* | ||
* @var PersonnePolitiquementExposee|null | ||
*/ | ||
protected $personnePolitiquementExposee; | ||
/** | ||
* Vaut vrai si le bénéficiaire effectif est actuellement sous sanction. Uniquement présent si demandé dans les champs supplémentaires. | ||
* | ||
* @var bool|null | ||
*/ | ||
protected $sanctionsEnCours; | ||
/** | ||
* Liste des sanctions du bénéficiaire effectif. Uniquement présent si demandé dans les champs supplémentaires. | ||
* | ||
* @var Sanction[]|null | ||
*/ | ||
protected $sanctions; | ||
|
||
/** | ||
* Informations sur le statut de personne politiquement exposée. Uniquement présent si demandé dans les champs supplémentaires. | ||
*/ | ||
public function getPersonnePolitiquementExposee(): ?PersonnePolitiquementExposee | ||
{ | ||
return $this->personnePolitiquementExposee; | ||
} | ||
|
||
/** | ||
* Informations sur le statut de personne politiquement exposée. Uniquement présent si demandé dans les champs supplémentaires. | ||
*/ | ||
public function setPersonnePolitiquementExposee(?PersonnePolitiquementExposee $personnePolitiquementExposee): self | ||
{ | ||
$this->initialized['personnePolitiquementExposee'] = true; | ||
$this->personnePolitiquementExposee = $personnePolitiquementExposee; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Vaut vrai si le bénéficiaire effectif est actuellement sous sanction. Uniquement présent si demandé dans les champs supplémentaires. | ||
*/ | ||
public function getSanctionsEnCours(): ?bool | ||
{ | ||
return $this->sanctionsEnCours; | ||
} | ||
|
||
/** | ||
* Vaut vrai si le bénéficiaire effectif est actuellement sous sanction. Uniquement présent si demandé dans les champs supplémentaires. | ||
*/ | ||
public function setSanctionsEnCours(?bool $sanctionsEnCours): self | ||
{ | ||
$this->initialized['sanctionsEnCours'] = true; | ||
$this->sanctionsEnCours = $sanctionsEnCours; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Liste des sanctions du bénéficiaire effectif. Uniquement présent si demandé dans les champs supplémentaires. | ||
* | ||
* @return Sanction[]|null | ||
*/ | ||
public function getSanctions(): ?array | ||
{ | ||
return $this->sanctions; | ||
} | ||
|
||
/** | ||
* Liste des sanctions du bénéficiaire effectif. Uniquement présent si demandé dans les champs supplémentaires. | ||
* | ||
* @param Sanction[]|null $sanctions | ||
*/ | ||
public function setSanctions(?array $sanctions): self | ||
{ | ||
$this->initialized['sanctions'] = true; | ||
$this->sanctions = $sanctions; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.