Skip to content

Commit

Permalink
Release 0.2.1 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoman4eg authored Apr 10, 2022
1 parent 9f91fdc commit 1412686
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
All notable changes to this project will be documented in this file.
<!--- END HEADER -->

## [0.2.1](https://github.com/shoman4eg/moy-nalog/compare/v0.2.0...v0.2.1) (2022-04-11)

### Documentation
* Fix cancel income method docs

* Ошибка в документации #9

### Fix
* Type email can be nullable #10
* Fix Receipt print url #11

---

## [0.2.0](https://github.com/shoman4eg/moy-nalog/compare/v0.1.0...v0.2.0) (2022-04-09)
### Features
* Add Payment type methods
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ $comment = \Shoman4eg\Nalog\Enum\CancelCommentType::CANCEL;
$partnerCode = null; // Default null
$operationTime = new DateTimeImmutable('now'); //Default 'now'
$requestTime = new DateTimeImmutable('now'); //Default 'now'
$incomeInfo = $apiClient->income()->cancel($receiptUuid, $comment, $partnerCode, $operationTime, $requestTime);
$incomeInfo = $apiClient->income()->cancel($receiptUuid, $comment, $operationTime, $requestTime, $partnerCode);
```

### Create Invoice
Expand Down
2 changes: 1 addition & 1 deletion src/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function receipt(): Api\Receipt
$this->getHttpClient(),
$this->requestBuilder,
$this->profile ?? $this->user()->get(),
$this->clientConfigurator->getEndpoint()
(string)$this->clientConfigurator->getEndpoint()
);
}

Expand Down
9 changes: 4 additions & 5 deletions src/Http/ClientConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Http\Discovery\Psr17FactoryDiscovery;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface;
use Shoman4eg\Nalog\DTO\DeviceInfo;

/**
Expand Down Expand Up @@ -58,9 +59,7 @@ public function createConfiguredClient(): PluginClient
if ($this->configurationModified) {
$this->configurationModified = false;
$plugins = $this->prependPlugins;
$plugins[] = new Plugin\BaseUriPlugin(
$this->uriFactory->createUri(sprintf('%s/%s', $this->endpoint, $this->version))
);
$plugins[] = new Plugin\BaseUriPlugin($this->getEndpoint());
$plugins[] = new Plugin\HeaderDefaultsPlugin([
'User-Agent' => DeviceInfo::USER_AGENT,
'Content-type' => 'application/json',
Expand Down Expand Up @@ -124,8 +123,8 @@ public function removePlugin(string $fqcn): void
}
}

public function getEndpoint(): string
public function getEndpoint(): UriInterface
{
return $this->endpoint;
return $this->uriFactory->createUri(sprintf('%s/%s', $this->endpoint, $this->version));
}
}
6 changes: 3 additions & 3 deletions src/Model/User/UserType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UserType implements CreatableFromArray
private int $id;
private string $displayName;
private ?string $middleName;
private string $email;
private ?string $email;
private string $phone;
private string $inn;
private ?string $snils;
Expand All @@ -36,7 +36,7 @@ public static function createFromArray(array $data): self
$model->lastName = $data['lastName'];
$model->displayName = $data['displayName'];
$model->middleName = $data['middleName'];
$model->email = $data['email'];
$model->email = $data['email'] ?? null;
$model->phone = $data['phone'];
$model->inn = $data['inn'];
$model->snils = $data['snils'];
Expand Down Expand Up @@ -101,7 +101,7 @@ public function getMiddleName(): ?string
return $this->middleName;
}

public function getEmail(): string
public function getEmail(): ?string
{
return $this->email;
}
Expand Down
1 change: 0 additions & 1 deletion tests/Api/ReceiptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class ReceiptTest extends ApiTestCase
public function testPrintUrl(): void
{
$receiptId = 'dasdasdasd';
// var_dump();
$response = $this->client->receipt()->printUrl($receiptId);
$expected = sprintf('/receipt/%s/%s/print', '3000000000000', $receiptId);
self::assertStringContainsString($expected, $response);
Expand Down

0 comments on commit 1412686

Please sign in to comment.