diff --git a/.env b/.env index 87de11f..48f49b7 100644 --- a/.env +++ b/.env @@ -19,4 +19,4 @@ COOKIE_SECURE= DATABASE_URL= PONT_BASCULE_BYPASS= -PONT_BASCULE_URL= +PONT_BASCULE_BASE_URL= diff --git a/config/services.yaml b/config/services.yaml index 5cfcb7a..b24d6f6 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -24,7 +24,7 @@ services: App\Service\PontBasculeService: arguments: - $endpoint: '%env(PONT_BASCULE_URL)%' + $baseUrl: '%env(PONT_BASCULE_BASE_URL)%' $bypass: '%env(bool:PONT_BASCULE_BYPASS)%' # add more service definitions when explicit configuration is needed diff --git a/src/Service/PontBasculeService.php b/src/Service/PontBasculeService.php index de6e048..6c1237c 100644 --- a/src/Service/PontBasculeService.php +++ b/src/Service/PontBasculeService.php @@ -15,7 +15,7 @@ final class PontBasculeService public function __construct( private readonly HttpClientInterface $httpClient, private readonly PontBasculePayloadDecoder $payloadDecoder, - private readonly string $endpoint, + private readonly string $baseUrl, private readonly bool $bypass, ) {} @@ -28,7 +28,7 @@ final class PontBasculeService $body = $this->getBypassPayload(); } else { try { - $response = $this->httpClient->request('POST', $this->endpoint); + $response = $this->httpClient->request('POST', $this->baseUrl.'/send/dsd'); $body = $response->getContent(false); } catch (TransportExceptionInterface $exception) { throw PontBasculeException::transportFailure($exception->getMessage()); diff --git a/tests/Service/PontBasculeServiceTest.php b/tests/Service/PontBasculeServiceTest.php index 751c4ce..543f55a 100644 --- a/tests/Service/PontBasculeServiceTest.php +++ b/tests/Service/PontBasculeServiceTest.php @@ -47,7 +47,7 @@ final class PontBasculeServiceTest extends TestCase $httpClient ->expects(self::once()) ->method('request') - ->with('POST', 'http://example.test') + ->with('POST', 'http://example.test/send/dsd') ->willReturn($response) ;