feat : expose IpBCreateSortie via BovinApi::createSortie

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 14:58:32 +02:00
parent 5c0c894e37
commit 32a573d473
3 changed files with 50 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ use Malio\EdnotifBundle\Bovin\Api\BovinApiInterface;
use Malio\EdnotifBundle\Bovin\Mapper\AnimalFileMapper;
use Malio\EdnotifBundle\Bovin\Mapper\AnimalSummaryMapper;
use Malio\EdnotifBundle\Bovin\Mapper\CreateEntreeResponseMapper;
use Malio\EdnotifBundle\Bovin\Mapper\CreateSortieResponseMapper;
use Malio\EdnotifBundle\Bovin\Mapper\InventoryMapper;
use Malio\EdnotifBundle\Bovin\Mapper\PresumedExitsMapper;
use Malio\EdnotifBundle\Bovin\Mapper\ReturnedDossiersMapper;
@@ -71,6 +72,12 @@ return static function (ContainerConfigurator $container): void {
])
;
$services->set(CreateSortieResponseMapper::class)
->args([
service(StandardResponseMapper::class),
])
;
$services->set(TokenProvider::class)
->args([
service('ednotif.soap.guichet'),
@@ -93,6 +100,7 @@ return static function (ContainerConfigurator $container): void {
service(ReturnedDossiersMapper::class),
service(PresumedExitsMapper::class),
service(CreateEntreeResponseMapper::class),
service(CreateSortieResponseMapper::class),
service(ZipMessageDecoder::class),
'%ednotif.exploitation_country_code%',
'%ednotif.exploitation_number%',

View File

@@ -9,11 +9,14 @@ use Malio\EdnotifBundle\Auth\TokenProvider;
use Malio\EdnotifBundle\Bovin\Dto\AnimalFileDto;
use Malio\EdnotifBundle\Bovin\Dto\CreateEntreeRequest;
use Malio\EdnotifBundle\Bovin\Dto\CreateEntreeResponseDto;
use Malio\EdnotifBundle\Bovin\Dto\CreateSortieRequest;
use Malio\EdnotifBundle\Bovin\Dto\CreateSortieResponseDto;
use Malio\EdnotifBundle\Bovin\Dto\InventoryDto;
use Malio\EdnotifBundle\Bovin\Dto\PresumedExitsDto;
use Malio\EdnotifBundle\Bovin\Dto\ReturnedDossiersDto;
use Malio\EdnotifBundle\Bovin\Mapper\AnimalFileMapper;
use Malio\EdnotifBundle\Bovin\Mapper\CreateEntreeResponseMapper;
use Malio\EdnotifBundle\Bovin\Mapper\CreateSortieResponseMapper;
use Malio\EdnotifBundle\Bovin\Mapper\InventoryMapper;
use Malio\EdnotifBundle\Bovin\Mapper\PresumedExitsMapper;
use Malio\EdnotifBundle\Bovin\Mapper\ReturnedDossiersMapper;
@@ -33,6 +36,7 @@ final readonly class BovinApi implements BovinApiInterface
private ReturnedDossiersMapper $returnedDossiersMapper,
private PresumedExitsMapper $presumedExitsMapper,
private CreateEntreeResponseMapper $createEntreeResponseMapper,
private CreateSortieResponseMapper $createSortieResponseMapper,
private ZipMessageDecoder $zipMessageDecoder,
private string $exploitationCountryCode,
private string $exploitationNumber,
@@ -202,6 +206,40 @@ final readonly class BovinApi implements BovinApiInterface
return $this->createEntreeResponseMapper->map($soapResponse);
}
public function createSortie(CreateSortieRequest $request): CreateSortieResponseDto
{
$token = $this->tokenProvider->getToken();
$payload = [
'JetonAuthentification' => $token,
'Exploitation' => [
'CodePays' => $this->exploitationCountryCode,
'NumeroExploitation' => $this->exploitationNumber,
],
'Bovin' => [
'CodePays' => $request->bovin->countryCode,
'NumeroNational' => $request->bovin->nationalNumber,
],
'DateSortie' => $request->date->format('Y-m-d'),
'CauseSortie' => $request->cause->value,
'ExploitationDestination' => [
'CodePays' => $request->destination->countryCode,
'NumeroExploitation' => $request->destination->exploitationNumber,
],
];
try {
/** @var object $soapResponse */
$soapResponse = $this->businessClient->__soapCall('IpBCreateSortie', [$payload]);
} catch (SoapFault $soapFault) {
throw new RuntimeException('SOAP Fault on IpBCreateSortie: '.$soapFault->getMessage(), 0, $soapFault);
}
$this->assertSuccessfulResponse($soapResponse, 'IpBCreateSortie');
return $this->createSortieResponseMapper->map($soapResponse);
}
private function assertSuccessfulResponse(object $soapResponse, string $operation): void
{
$standardResponseNode = $soapResponse->ReponseStandard ?? null;

View File

@@ -8,6 +8,8 @@ use DateTimeInterface;
use Malio\EdnotifBundle\Bovin\Dto\AnimalFileDto;
use Malio\EdnotifBundle\Bovin\Dto\CreateEntreeRequest;
use Malio\EdnotifBundle\Bovin\Dto\CreateEntreeResponseDto;
use Malio\EdnotifBundle\Bovin\Dto\CreateSortieRequest;
use Malio\EdnotifBundle\Bovin\Dto\CreateSortieResponseDto;
use Malio\EdnotifBundle\Bovin\Dto\InventoryDto;
use Malio\EdnotifBundle\Bovin\Dto\PresumedExitsDto;
use Malio\EdnotifBundle\Bovin\Dto\ReturnedDossiersDto;
@@ -27,4 +29,6 @@ interface BovinApiInterface
public function getPresumedExits(): PresumedExitsDto;
public function createEntree(CreateEntreeRequest $request): CreateEntreeResponseDto;
public function createSortie(CreateSortieRequest $request): CreateSortieResponseDto;
}