Skip to content

Commit f3da8ed

Browse files
committed
removed parameter serialNumber, use concat value in number
1 parent 14aa2ed commit f3da8ed

3 files changed

Lines changed: 7 additions & 17 deletions

File tree

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ Choose and install
2525
[PSR-18 HTTP Client implementation](https://packagist.org/providers/psr/http-client-implementation) and
2626
[PSR-17 HTTP Factory implementation](https://packagist.org/providers/psr/http-factory-implementation).
2727

28-
```
29-
$ composer require czechphp/invalid-document kriswallsmith/buzz nyholm/psr7
30-
```
31-
3228
## Basic usage
3329
```php
3430
<?php
@@ -40,7 +36,7 @@ $requestFactory = null; // anything that implements PSR-17 HTTP Factory
4036

4137
$invalidDocument = new InvalidDocument($client, $requestFactory);
4238

43-
$message = $invalidDocument->get(InvalidDocument::IDENTIFICATION_CARD, '123456', 'AB');
39+
$message = $invalidDocument->get(InvalidDocument::IDENTIFICATION_CARD, '123456AB');
4440

4541
if (true === $message->isRegistered()) {
4642
// the document is in registry of invalid documents

src/InvalidDocument.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,12 @@ public function __construct(ClientInterface $client, RequestFactoryInterface $re
5353
}
5454

5555
/**
56-
* @param int $documentType
57-
* @param string $number
58-
* @param string|null $serialNumber
59-
*
60-
* @return MessageInterface
61-
*
6256
* @throws InvalidArgumentException
6357
* @throws ServerErrorException
6458
*/
65-
public function get(int $documentType, string $number, ?string $serialNumber = null): MessageInterface
59+
public function get(int $documentType, string $number): MessageInterface
6660
{
67-
$request = $this->requestFactory->createRequest('GET', $this->getUri($documentType, $number, $serialNumber));
61+
$request = $this->requestFactory->createRequest('GET', $this->getUri($documentType, $number));
6862

6963
try {
7064
$response = $this->client->sendRequest($request);
@@ -75,10 +69,10 @@ public function get(int $documentType, string $number, ?string $serialNumber = n
7569
return $this->responseParser->parse($response->getBody()->getContents());
7670
}
7771

78-
private function getUri(int $documentType, string $number, ?string $serialNumber = null): string
72+
private function getUri(int $documentType, string $number): string
7973
{
8074
return sprintf('%s?%s', $this->uri, http_build_query([
81-
'dotaz' => $number . $serialNumber,
75+
'dotaz' => $number,
8276
'doklad' => $documentType,
8377
]));
8478
}

tests/InvalidDocumentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testSuccess(): void
3636

3737
$invalidDocument = new InvalidDocument($client, $requestFactory, $parser);
3838

39-
$this->assertEquals($message, $invalidDocument->get(InvalidDocument::IDENTIFICATION_CARD, '', ''));
39+
$this->assertEquals($message, $invalidDocument->get(InvalidDocument::IDENTIFICATION_CARD, '123AB'));
4040
}
4141

4242
public function testClientException(): void
@@ -54,6 +54,6 @@ public function testClientException(): void
5454

5555
$this->expectException(ServerErrorException::class);
5656

57-
$invalidDocument->get(InvalidDocument::IDENTIFICATION_CARD, '');
57+
$invalidDocument->get(InvalidDocument::IDENTIFICATION_CARD, '123AB');
5858
}
5959
}

0 commit comments

Comments
 (0)